【问题标题】:Cannot get all rows from Rad Grid-View with DataPager无法使用 DataPager 从 Rad Grid-View 获取所有行
【发布时间】:2013-12-18 12:08:26
【问题描述】:

这是我的 dataGridView ,

 <telerik:RadGrid ID="grdSalaryCalculation" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                    Skin="Telerik" Font-Names="Myanmar3" CellSpacing="0" EnableLinqExpressions="False"
                    OnNeedDataSource="grdSalaryCalculation_NeedDataSource" GridLines="None" ShowFooter="True"
                    PageSize="5" AllowSorting="true" OnItemDataBound="grdSalaryCalculation_ItemDataBound">
                    <ExportSettings ExportOnlyData="True" FileName="Attendance List">
                    </ExportSettings>
                    <GroupingSettings CaseSensitive="false"></GroupingSettings>
                    <MasterTableView DataKeyNames="EmpID,NRC" CommandItemDisplay="Top" AllowFilteringByColumn="true"
                        HeaderStyle-HorizontalAlign="Center" EnableHeaderContextMenu="true" EnableHeaderContextFilterMenu="true"
                        IsFilterItemExpanded="false" AllowSorting="true">
                        <CommandItemSettings ShowAddNewRecordButton="false" ShowExportToExcelButton="true">
                        </CommandItemSettings>
                        <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </ExpandCollapseColumn>
                        <Columns>
                        ......
                        ......

这就是我循环 dataRow 并获取的方式

        foreach (GridDataItem dataItem in grdSalaryCalculation.MasterTableView.Items)
        {

我的 GridView 大约有 20 行,但我使用了 PageSize=5
使用上面的代码,我只能得到 5 行。
如何从 GridView 获取所有行(20 行)?

【问题讨论】:

    标签: c# asp.net datagridview telerik radgrid


    【解决方案1】:

    已修复!
    使用this 链接,只需在循环的开头和结尾添加AllowPaging=false and true

    RadGrid1.AllowPaging = false;
    RadGrid1.Rebind();
    
            foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
            {
    
            }
    
    RadGrid1.AllowPaging = true;
    RadGrid1.Rebind();
    

    此代码可以通过分页从 Data GridView 中获取所有行!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-27
      • 2018-11-14
      • 2020-12-29
      • 2013-08-23
      • 2018-07-17
      • 2013-08-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多