Hi,
I would like to modify PageSizeComboBox to include total number of records in the grid, i.e. allow users to show all records on one page. To achieve that, I first get the row counts by doing:
and then I modified PageSizeComboBox by doing:
This does add the record count to PageSizeComboBox, however, when I select this added item in PageSizeComboBox, it doesn't update the grid. So then I tried to change the last item in PageSizeComboBox:
This works. However, if I did drag-n-drop grouping after setting the page size to RecordCount, the page size was automatically set to the first item in the combobox, rather than the last item. Could you please advise the best way to update PageSizeComboBox items?
Thanks,
I would like to modify PageSizeComboBox to include total number of records in the grid, i.e. allow users to show all records on one page. To achieve that, I first get the row counts by doing:
// get total record counts |
if (e.Item is GridFooterItem) |
{ |
GridFooterItem footer = (GridFooterItem)e.Item; |
ViewState["RecordCount"] = footer["IdCountInFooter"].Text.Replace("Count : ", ""); |
} |
and then I modified PageSizeComboBox by doing:
// change Page Size Combobox |
if (e.Item is GridPagerItem && ViewState["RecordCount"] != null) |
{ |
GridPagerItem pager = (GridPagerItem)e.Item; |
RadComboBox pageSizeComboBox = (RadComboBox)pager.FindControl("PageSizeComboBox"); |
PageSizeComboBox.Items.Add(new RadComboBoxItem(ViewState["RecordCount"].ToString(), ViewState["RecordCount"].ToString())); |
} |
This does add the record count to PageSizeComboBox, however, when I select this added item in PageSizeComboBox, it doesn't update the grid. So then I tried to change the last item in PageSizeComboBox:
// change Page Size Combobox |
if (e.Item is GridPagerItem && ViewState["RecordCount"] != null) |
{ |
GridPagerItem pager = (GridPagerItem)e.Item; |
RadComboBox pageSizeComboBox = (RadComboBox)pager.FindControl("PageSizeComboBox"); |
// added item doesn't fire |
// PageSizeComboBox.Items.Add(new RadComboBoxItem(ViewState["RecordCount"].ToString(), ViewState["RecordCount"].ToString())); |
pageSizeComboBox.Items[3].Text = ViewState["RecordCount"].ToString(); |
pageSizeComboBox.Items[3].Value = ViewState["RecordCount"].ToString(); |
} |
This works. However, if I did drag-n-drop grouping after setting the page size to RecordCount, the page size was automatically set to the first item in the combobox, rather than the last item. Could you please advise the best way to update PageSizeComboBox items?
Thanks,