Files
b2bcondomini.it/PUB/WebUserContols/mod_F2A.ascx.cs
T
2018-09-24 14:22:45 +02:00

106 lines
2.4 KiB
C#

using SteamWare;
using System;
using System.Web.UI.WebControls;
namespace PUB.WebUserContols
{
public partial class mod_F2A : System.Web.UI.UserControl
{
/// <summary>
/// indicato (nuovo) numero righe x pagina
/// </summary>
public event EventHandler eh_selected;
/// <summary>
/// indicato (nuovo) numero righe x pagina
/// </summary>
public event EventHandler eh_reset;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
grView.PageSize = cmp_numRow.numRowPag;
}
cmp_numRow.eh_newNum += Cmp_numRow_eh_newNum;
}
private void Cmp_numRow_eh_newNum(object sender, EventArgs e)
{
grView.PageSize = cmp_numRow.numRowPag;
}
/// <summary>
/// Update num righe selezionate
/// </summary>
private void updNumRows()
{
int rowCount = 0;
rowCount = grView.PageSize * grView.PageCount;
lblNumRecords.Text = string.Format("~{0} rec", rowCount);
}
/// <summary>
/// Area selezionata
/// </summary>
public int idxArea
{
get
{
int answ = 0;
int.TryParse(hfIdxArea.Value, out answ);
return answ;
}
set
{
hfIdxArea.Value = value.ToString();
}
}
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
string nomeForn = "";
try
{
var ctrl = grView.SelectedRow.FindControl("lblnomeForn");
nomeForn = ((Label)ctrl).Text;
}
catch
{ }
if (nomeForn != "")
{
searchVal = nomeForn;
Response.Redirect("AnagFornitori");
}
else
{
// sollevo evento nuovo valore...
if (eh_selected != null)
{
eh_selected(this, new EventArgs());
}
}
}
public string searchVal
{
get
{
return memLayer.ML.StringSessionObj("siteSearchVal");
}
set
{
memLayer.ML.setSessionVal("siteSearchVal", value);
}
}
protected void grView_DataBound(object sender, EventArgs e)
{
updNumRows();
}
protected void lbtReset_Click(object sender, EventArgs e)
{
grView.SelectedIndex = -1;
grView.DataBind();
// sollevo evento nuovo valore...
if (eh_reset != null)
{
eh_reset(this, new EventArgs());
}
}
}
}