n ASP .NET 4.5 SelectMethod is not able to bind data to grid view on button click

pipotalamo

New Member
I am using ASP.Net 4.5 , and facing an issue regarding with data binding for grid view using 'Select method'.The grid is able to bind the data on custom paging too. The issue lies in filtering the data. I have a asp button, By clicking on this i am able to get filtered data using stored proc. but this time grid is not able to call the method which i mentioned in aspx page for that grid in SelectMethod.AutoGenerateColumns="False"OnRowCommand="gEmployee_Command" CellPadding="4"OnRowDataBound="gEmployee_RowDataBound"AllowCustomPaging="true" PageSize="10" PagerSettings-Visible="false"CssClass="mGrid"AllowSorting ="true"AlternatingRowStyle-CssClass="alt"ItemType="ModelEntityLayer.ClsEmployee" SelectMethod="BindGrid" OnSorting ="gEmployee_OnSorting" HeaderStyle-Wrap="false" DataKeyNames="PropClockNumber" >code above shows the properties which i have set for grid view.public IQueryable BindGrid()\[code\]{ int intTotalPages = 0; objBALEmployee = new ClsEmployeeBAL(); List<ClsEmployee> employee = null; if ((string)Session["QueryResult"] != null) { employee = objBALEmployee.GetPageWiseData(gEmployee.PageIndex, gEmployee.PageSize, ViewState["SortExpression"] != null ? ViewState["SortExpression"].ToString() : ViewState["ClockNumber"].ToString(), ViewState["SortOrder"] != null ? ViewState["SortOrder"].ToString() : "asc", ref intTotalPages, ((string)Session["QueryResult"])); Session.Remove("QueryResult"); } else { if (Convert.ToInt32(ViewState["IsEditSearch"]) != 1) { employee = objBALEmployee.GetPageWiseData(gEmployee.PageIndex, ViewState["SortExpression"] != null ? ViewState["SortExpression"].ToString() : ViewState["ClockNumber"].ToString(), ViewState["SortOrder"] != null ? ViewState["SortOrder"].ToString() : "asc", gEmployee.PageSize, ref intTotalPages); } else { employee = objBALEmployee.GetPageWiseData(gEmployee.PageIndex, gEmployee.PageSize, ViewState["SortExpression"] != null ? ViewState["SortExpression"].ToString() : ViewState["ClockNumber"].ToString(), ViewState["SortOrder"] != null ? ViewState["SortOrder"].ToString() : "asc", ref intTotalPages, dlEmployee.SelectedValue+" = '"+txtSearch.Text.Trim()+"'"); } } var lstEmployee = employee.AsQueryable(); if (intTotalPages > 0) { CustomPager.TotalPages = intTotalPages %gEmployee.PageSize == 0 ? intTotalPages /gEmployee.PageSize : intTotalPages / gEmployee.PageSize + 1; CustomPager.Visible = true; lblNoRecordsFound.Visible = false; NoRecords.Visible = false; } else { CustomPager.Visible = false; lblNoRecordsFound.Visible = true; NoRecords.Visible = true; } ExportData1.DisableBtn(gEmployee); ExportData.ExportCheck = false; return lstEmployee;}\[/code\]The above code shows the bindGrid method which i have set for the selectMethod in grid.protected void btnGo_Click(object sender, EventArgs e)\[code\]{ ViewState["IsEditSearch"] = "1"; hiddenSearchField.Value = http://stackoverflow.com/questions/15608470/dlEmployee.SelectedValue; hiddenSearchValue.Value = txtSearch.Text.Trim(); gEmployee.SelectMethod ="BindGrid";}\[/code\]The above code is written for buttn click.Though i have written gEmployee.SelectMethod = "BindGrid"; once again on click code, BindGrid is not getting fired. So i am not able to bind my newly filtered data to grid.Please guide me on this.Thanks.
 
Top