Fix paging...

This commit is contained in:
Samuele E. Locatelli
2019-06-04 16:02:36 +02:00
parent 2844395392
commit 463ccd1456
9 changed files with 206 additions and 127 deletions
+16 -5
View File
@@ -12,19 +12,30 @@
<div class="container" style="font-size: 0.8em;">
<div class="card bg-default">
<div class="card-header">
<b><%: traduci("ElencoLinee") %></b>
<div class="d-flex">
<div class="mr-auto px-2">
<b><%: traduci("ElencoLinee") %></b>
</div>
<div class="px-2">
<uc1:mod_righePag runat="server" ID="mod_righePag" />
</div>
</div>
</div>
<div class="card-body py-1 bg-light text-dark" style="min-height: 200px;">
<uc1:mod_ricercaGenerica runat="server" ID="mod_ricercaGenerica" />
<uc1:mod_anagTipoLinee runat="server" ID="mod_anagTipoLinee" />
</div>
<div class="card-footer py-1 text-right">
<uc1:mod_righePag runat="server" ID="mod_righePag" />
</div>
</div>
<div class="card bg-info text-light" runat="server" id="divDetail" visible="false">
<div class="card-header">
<b><%: traduci("DettLineeAss") %></b>
<div class="d-flex">
<div class="mr-auto px-2">
<b><%: traduci("DettLineeAss") %></b>
</div>
<div class="px-2">
<uc1:mod_righePag runat="server" ID="mod_righePag1" />
</div>
</div>
</div>
<div class="card-body bg-light text-dark">
<uc1:mod_anagLinee runat="server" ID="mod_anagLinee" />
+8
View File
@@ -11,9 +11,17 @@ namespace GMW
{
mod_righePag.numRowPag = 3;
mod_anagTipoLinee.numRows = mod_righePag.numRowPag;
mod_righePag1.numRowPag = 20;
mod_anagLinee.numRows = mod_righePag1.numRowPag;
}
mod_anagTipoLinee.eh_ucev += Mod_anagTipoLinee_eh_ucev;
mod_righePag.eh_newNum += Mod_righePag_eh_newNum;
mod_righePag1.eh_newNum += Mod_righePag1_eh_newNum;
}
private void Mod_righePag1_eh_newNum(object sender, EventArgs e)
{
mod_anagLinee.numRows = mod_righePag1.numRowPag;
}
private void Mod_righePag_eh_newNum(object sender, EventArgs e)
+18 -9
View File
@@ -12,6 +12,15 @@ namespace GMW {
public partial class AnagLinee {
/// <summary>
/// Controllo mod_righePag.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::GMW.WebUserControls.mod_righePag mod_righePag;
/// <summary>
/// Controllo mod_ricercaGenerica.
/// </summary>
@@ -30,15 +39,6 @@ namespace GMW {
/// </remarks>
protected global::GMW.WebUserControls.mod_anagTipoLinee mod_anagTipoLinee;
/// <summary>
/// Controllo mod_righePag.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::GMW.WebUserControls.mod_righePag mod_righePag;
/// <summary>
/// Controllo divDetail.
/// </summary>
@@ -48,6 +48,15 @@ namespace GMW {
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divDetail;
/// <summary>
/// Controllo mod_righePag1.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::GMW.WebUserControls.mod_righePag mod_righePag1;
/// <summary>
/// Controllo mod_anagLinee.
/// </summary>
+1 -3
View File
@@ -3,15 +3,13 @@
{ %>
<link href="../Content/Style.css" rel="stylesheet" type="text/css" />
<% } %>
<asp:GridView ID="grView" runat="server" DataSourceID="ods" DataKeyNames="CodLinea" AutoGenerateColumns="False" AllowSorting="True" OnSelectedIndexChanged="grView_SelectedIndexChanged" CssClass="table table-striped table-condensed table-sm">
<asp:GridView ID="grView" runat="server" DataSourceID="ods" DataKeyNames="CodLinea" AutoGenerateColumns="False" AllowSorting="True" OnSelectedIndexChanged="grView_SelectedIndexChanged" CssClass="table table-striped table-condensed table-sm" AllowPaging="true">
<HeaderStyle CssClass="default" />
<PagerStyle CssClass="active GridPager" />
<PagerSettings Mode="NumericFirstLast" />
<SelectedRowStyle CssClass="info" />
<EmptyDataTemplate>
Nessun Record
<%--<asp:Button ID="btnNew" runat="server" OnClick="btnNewFromEmpty_Click" Text='<%# traduci("New") %>'
Visible='<%# isWritable() %>' />--%>
</EmptyDataTemplate>
<Columns>
<asp:TemplateField ShowHeader="False" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="6em">
+15
View File
@@ -221,5 +221,20 @@ namespace GMW.WebUserControls
if (!_codLinea.ToString().EndsWith("00")) answ = true;
return answ;
}
/// <summary>
/// numero righe da mostrare
/// </summary>
public int numRows
{
get
{
return grView.PageSize;
}
set
{
grView.PageSize = value;
grView.DataBind();
}
}
}
}
+101 -91
View File
@@ -4,97 +4,107 @@ using System.Web.UI;
namespace GMW.WebUserControls
{
public partial class mod_righePag : System.Web.UI.UserControl
public partial class mod_righePag : System.Web.UI.UserControl
{
/// <summary>
/// indicato (nuovo) numero righe x pagina
/// </summary>
public event EventHandler eh_newNum;
/// <summary>
/// caricamento pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
/// <summary>
/// indicato (nuovo) numero righe x pagina
/// </summary>
public event EventHandler eh_newNum;
/// <summary>
/// caricamento pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
numRowReq = numRowPag;
}
}
/// <summary>
/// effettua traduzione del lemma
/// </summary>
/// <param name="lemma"></param>
/// <returns></returns>
public string traduci(string lemma)
{
return user_std.UtSn.Traduci(lemma);
}
/// <summary>
/// aggiorno controllo paginazione...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtNumRighe_TextChanged(object sender, EventArgs e)
{
// salvo num righe...
numRowPag = numRowReq;
// sollevo evento nuovo valore...
if (eh_newNum != null)
{
eh_newNum(this, new EventArgs());
}
}
/// <summary>
/// numero righe per pagina (in sessione)
/// </summary>
public int numRowPag
{
get
{
int answ = 10;
try
{
answ = memLayer.ML.IntSessionObj("numRowPag");
}
catch
{
answ = 10;
}
return answ;
}
set
{
memLayer.ML.setSessionVal("numRowPag", value);
numRowReq = value;
}
}
/// <summary>
/// numero righe gridview da mostrare legato a controllo textbox
/// </summary>
protected int numRowReq
{
get
{
int answ = numRowPag;
try
{
answ = Convert.ToInt32(txtNumRighe.Text.Trim());
if (answ == 0)
{
answ = numRowPag;
txtNumRighe.Text = answ.ToString();
}
}
catch
{ }
return answ;
}
set
{
txtNumRighe.Text = value.ToString();
}
}
if (!Page.IsPostBack)
{
numRowReq = numRowPag;
}
}
/// <summary>
/// stringa UID univoca
/// </summary>
public string uid
{
get
{
return this.UniqueID.Replace("$", "_").Replace("-", "_");
}
}
/// <summary>
/// effettua traduzione del lemma
/// </summary>
/// <param name="lemma"></param>
/// <returns></returns>
public string traduci(string lemma)
{
return user_std.UtSn.Traduci(lemma);
}
/// <summary>
/// aggiorno controllo paginazione...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtNumRighe_TextChanged(object sender, EventArgs e)
{
// salvo num righe...
numRowPag = numRowReq;
// sollevo evento nuovo valore...
if (eh_newNum != null)
{
eh_newNum(this, new EventArgs());
}
}
/// <summary>
/// numero righe per pagina (in sessione)
/// </summary>
public int numRowPag
{
get
{
int answ = 10;
try
{
answ = memLayer.ML.IntSessionObj(uid + "_numRowPag");
}
catch
{
answ = 10;
}
return answ;
}
set
{
memLayer.ML.setSessionVal(uid + "_numRowPag", value);
numRowReq = value;
}
}
/// <summary>
/// numero righe gridview da mostrare legato a controllo textbox
/// </summary>
protected int numRowReq
{
get
{
int answ = numRowPag;
try
{
answ = Convert.ToInt32(txtNumRighe.Text.Trim());
if (answ == 0)
{
answ = numRowPag;
txtNumRighe.Text = answ.ToString();
}
}
catch
{ }
return answ;
}
set
{
txtNumRighe.Text = value.ToString();
}
}
}
}
+21 -9
View File
@@ -1,4 +1,5 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/FullPage.master" AutoEventWireup="true" CodeBehind="confLinee.aspx.cs" Inherits="GMW.confLinee" %>
<%@ Register Src="~/WebUserControls/mod_ricercaGenerica.ascx" TagPrefix="uc1" TagName="mod_ricercaGenerica" %>
<%@ Register Src="~/WebUserControls/mod_anagTipoLinee.ascx" TagPrefix="uc1" TagName="mod_anagTipoLinee" %>
<%@ Register Src="~/WebUserControls/mod_righePag.ascx" TagPrefix="uc1" TagName="mod_righePag" %>
@@ -12,26 +13,37 @@
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MCon" runat="server">
<div class="container" style="font-size: 0.8em;">
<div class="container" style="font-size: 0.8em;">
<div class="card bg-default">
<div class="card-header">
<b><%: traduci("ElencoLinee") %></b>
<div class="card-header py-2">
<div class="d-flex">
<div class="mr-auto px-2">
<b><%: traduci("ElencoLinee") %></b>
</div>
<div class="px-2">
<uc1:mod_righePag runat="server" ID="mod_righePag" />
</div>
</div>
</div>
<div class="card-body py-1 bg-light text-dark" style="min-height: 200px;">
<uc1:mod_ricercaGenerica runat="server" ID="mod_ricercaGenerica" />
<uc1:mod_anagTipoLinee runat="server" ID="mod_anagTipoLinee" forceSelect="true" />
</div>
<div class="card-footer py-1 text-right">
<uc1:mod_righePag runat="server" ID="mod_righePag" />
</div>
</div>
<div class="card bg-info text-light" runat="server" id="divDetail" visible="false">
<div class="card-header">
<b><%: traduci("DettLineeAss") %></b>
<div class="card-header py-2">
<div class="d-flex">
<div class="mr-auto px-2">
<b><%: traduci("DettLineeAss") %></b>
</div>
<div class="px-2">
<uc1:mod_righePag runat="server" ID="mod_righePag1" />
</div>
</div>
</div>
<div class="card-body bg-light text-dark">
<uc1:mod_anagLinee runat="server" ID="mod_anagLinee" />
<uc1:mod_confLinea runat="server" id="mod_confLinea" />
<uc1:mod_confLinea runat="server" ID="mod_confLinea" />
</div>
</div>
</div>
+8 -1
View File
@@ -9,13 +9,20 @@ namespace GMW
{
if (!Page.IsPostBack)
{
mod_righePag.numRowPag = 5;
mod_righePag.numRowPag = 3;
mod_anagTipoLinee.numRows = mod_righePag.numRowPag;
mod_righePag1.numRowPag = 5;
mod_anagLinee.numRows = mod_righePag1.numRowPag;
}
mod_anagTipoLinee.eh_ucev += Mod_anagTipoLinee_eh_ucev;
mod_righePag.eh_newNum += Mod_righePag_eh_newNum;
mod_righePag1.eh_newNum += Mod_righePag1_eh_newNum;
}
private void Mod_righePag1_eh_newNum(object sender, EventArgs e)
{
mod_anagLinee.numRows = mod_righePag1.numRowPag;
}
private void Mod_righePag_eh_newNum(object sender, EventArgs e)
{
mod_anagTipoLinee.numRows = mod_righePag.numRowPag;
+18 -9
View File
@@ -12,6 +12,15 @@ namespace GMW {
public partial class confLinee {
/// <summary>
/// Controllo mod_righePag.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::GMW.WebUserControls.mod_righePag mod_righePag;
/// <summary>
/// Controllo mod_ricercaGenerica.
/// </summary>
@@ -30,15 +39,6 @@ namespace GMW {
/// </remarks>
protected global::GMW.WebUserControls.mod_anagTipoLinee mod_anagTipoLinee;
/// <summary>
/// Controllo mod_righePag.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::GMW.WebUserControls.mod_righePag mod_righePag;
/// <summary>
/// Controllo divDetail.
/// </summary>
@@ -48,6 +48,15 @@ namespace GMW {
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divDetail;
/// <summary>
/// Controllo mod_righePag1.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::GMW.WebUserControls.mod_righePag mod_righePag1;
/// <summary>
/// Controllo mod_anagLinee.
/// </summary>