开发者

In Telerik Radgrid, how can I page the results according the number of group headers?

开发者 https://www.devze.com 2023-01-10 08:48 出处:网络
Is there a way of set some \"PageSize\" property according the number of \"Group Headers\" in a RadGrid?

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 mat开发者_JS百科ches 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.


There is a pagesize property, but it doesn't take into affect the row type to do some specialized function. You'd have to examine the data (and do the grouping yourself) and manually calculate the groups... I don't know if that is an efficient solution.

What type of grouping calculation do you want to do?

0

精彩评论

暂无评论...
验证码 换一张
取 消