Is there a way of set some "PageSize" property according the number of "Group Headers" in a RadGrid?
Regards!
The code snippet is bellow:
protected void PageResults(DataTable AnyDataTable) {
//Textbox where user inserts the number of registers that will be showed per page.
if (txt_register_per_page.Value.HasValue)
{
int RegistersPerPage = 0, EveryItens = 0;
string OldData = "";
//The loop runs over all the table's rows.
for (int Index = 0; Index <= AnyDataTable.Rows.Count; Index++)
{
//The "ColumName" is the one that all the others will be grouped.
//If no matches with the current data, means that is another "group".
if (!(String.Equals(AnyDataTable.Rows[Index]["ColumnName"].ToString(), OldData)))
{
RegistersPerPage++;
if (RegistersPerPage == txt_register_per_page.Value)
{
EveryItens = Index;
break;
}
OldData = AnyDataTable.Rows[Index]["ColumnName"].ToString();
}
}
MyRadGrid.PageSize = EveryItens;
}
}
As I see, the PageSize property allows the grid to show pages based in ALL the registers, then I tried to begin writing something that converts the total data for the respective number of groups that the user inputs on the textbox.