Hi,
I have a radgrid with a lazy load method to handle the binding. The binding is done via a button's CustomParameter that, when it's clicked, provides the parameters for the query that populates the grid. Problem is: the Grid's NeedDataSource is triggered before the rebind call on the button's click event and messes up the whole thing.
Here is the grid NeedDataSource, where the 'bind' variable is to prevent the call when first accessing the page
protected void Quotas_Table_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { if (bind && Session["SessionId"] != null) { Quotas_Table.DataSource = Empresas_DAL.GetQuotasList((string)Session["TP_QT_" + (string)Session["SessionId"]], int.Parse((string)Session["PRD_QT_" + (string)Session["SessionId"]]), DateTime.Now.Year); } }
and here is the button's event, where all variables here are strings:
protected void Compilar_Click(object sender, EventArgs e) { LinkButton lnk = sender as LinkButton; string param = lnk.Attributes["CustomParameter"]; tipo = param.Substring(0, 1); periodo = param.Substring(1); Session["TP_QT_" + (string)Session["SessionId"]] = tipo; Session["PRD_QT_" + (string)Session["SessionId"]] = periodo; bind = true; Quotas_Table.Rebind(); }