Paging in DataGrid stopped working
-
:confused:I've created a pretty basic datagrid and had the paging working fine. Then when i created a different page (with a different datagrid) my paging stopped working for both. I used the same method name for both datagrids OnPageIndexChanged event. When i change them to different names, it still won't work. Anyone have any ideas how to fix? Here are the attributes of the Datagrid... PagerStyle-CssClass="smallblackbold" OnPageIndexChanged="dgr_searchResultsPageIndexChanged" PagerStyle-Mode=NumericPages PageSize=25 AllowPaging=True Thanks, BT.
-
:confused:I've created a pretty basic datagrid and had the paging working fine. Then when i created a different page (with a different datagrid) my paging stopped working for both. I used the same method name for both datagrids OnPageIndexChanged event. When i change them to different names, it still won't work. Anyone have any ideas how to fix? Here are the attributes of the Datagrid... PagerStyle-CssClass="smallblackbold" OnPageIndexChanged="dgr_searchResultsPageIndexChanged" PagerStyle-Mode=NumericPages PageSize=25 AllowPaging=True Thanks, BT.
Just off the top of my head.... Look at the end of each procedure's dgr_searchResultsPageIndexChanged event to see if the Handles keyword is reflecting the new datagrid name. I've changed control names in the past and the Handles' portion of the sub statement didn't reflect the new control's name. Hopefully this is the problem as it is an easy fix. Let me know if it corrects the problem. Michael
-
Just off the top of my head.... Look at the end of each procedure's dgr_searchResultsPageIndexChanged event to see if the Handles keyword is reflecting the new datagrid name. I've changed control names in the past and the Handles' portion of the sub statement didn't reflect the new control's name. Hopefully this is the problem as it is an easy fix. Let me know if it corrects the problem. Michael
The code behind is written in C# so the "Handles" keywords aren't used. Here is the code for the DataGrid: And here is the code behind: public void dgr_searchResultsPageIndexChanged(object sender, DataGridPageChangedEventArgs e) { setVariablesFromForm(); createProjectDataSet(); dgr_results.DataSource = dst_searchResults; dgr_results.CurrentPageIndex = e.NewPageIndex; dgr_results.DataBind(); } Thanks, BT
-
The code behind is written in C# so the "Handles" keywords aren't used. Here is the code for the DataGrid: And here is the code behind: public void dgr_searchResultsPageIndexChanged(object sender, DataGridPageChangedEventArgs e) { setVariablesFromForm(); createProjectDataSet(); dgr_results.DataSource = dst_searchResults; dgr_results.CurrentPageIndex = e.NewPageIndex; dgr_results.DataBind(); } Thanks, BT
For C#, you need the following in your InitializeComponent: this.IDOFYOURDATAGRID1.PageIndexChanged += new EventHandler(dgr_searchResultsPageIndexChanged); this.IDOFYOURDATAGRID2.PageIndexChanged += new EventHandler(dgr_searchResultsPageIndexChanged); And if you're using codebehind, you don't need OnPageIndexChanged="dgr_searchResultsPageIndexChanged" in your declaration. Hope that helps! Datagrid Girl