2

有没有办法根据 RadGrid 中“组标题”的数量设置一些“PageSize”属性?

问候!

代码片段如下:

    protected void PageResults(DataTable AnyDataTable) {

//用户插入每页将显示的寄存器数量的文本框。

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;
} 

}

如我所见,PageSize 属性允许网格显示基于所有寄存器的页面,然后我尝试开始编写一些东西来转换用户在文本框中输入的相应组数的总数据。

4

1 回答 1

0

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?

于 2010-08-02T15:51:09.900 回答