Check post back happen which control...
/// Get Which html Controls cause Postback...
///
///
///
public static Control GetPostBackControl(Page page)
{
Control control = null;
string ctrlname = page.Request.Params.Get("__EVENTTARGET");
if (ctrlname != null && ctrlname != string.Empty)
{
control = page.FindControl(ctrlname);
}
else
{
foreach (string ctl in page.Request.Form)
{
Control c = page.FindControl(ctl);
if (c is System.Web.UI.WebControls.Button)
{
control = c;
break;
}
}
}
return control;
}
===== Call Method in Page Load======
string ctrlname = Page.Request.Params.Get("__EVENTTARGET");
Control _ctlPostback =GetPostBackControl(this.Page);
if (_ctlPostback != null)
{
#region
if (_ctlPostback.ClientID.ToString().Equals("ctl00_ContentPlaceHolder1__ddlPagerSize"))
{
int _intGetPagerSize = int.Parse(_ddlPagerSize.SelectedValue.ToString());
string _strGetFilter = _ddlFilter.SelectedValue.ToString();
_gridEmployeeList.PageSize = _intGetPagerSize;
BindGrid();
}
#endregion
}



0 comments:
Post a Comment