简体   繁体   English

无法使用DataPager从Rad Grid-View获取所有行

[英]Cannot get all rows from Rad Grid-View with DataPager

This is my dataGridView , 这是我的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>
                        ......
                        ......

And this is how I loop dataRow and get 这就是我循环dataRow和获取的方式

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

My GridView has about 20 rows , but I used PageSize=5 . 我的GridView有大约20行,但我使用了PageSize=5
Using above code , I can get only 5 rows . 使用上面的代码,我只能获得5行。
How can I get all rows (20 rows) from GridView ? 如何从GridView获取所有行(20行)?

Fixed ! 固定!
Using this link , just add AllowPaging=false and true at the start and end of looping . 使用链接,只需在循环开始和结束时添加AllowPaging=false and true

RadGrid1.AllowPaging = false;
RadGrid1.Rebind();

        foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
        {

        }

RadGrid1.AllowPaging = true;
RadGrid1.Rebind();

This code can get all of rows from Data GridView with Paging ! 这段代码可以通过Paging从Data GridView获取所有行!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在子网格视图上单击“编辑”时,如何从父网格视图的下拉列表中获取价值? - How to get value in drop down-list from parent Grid-view when Click Edit on child grid-view? 如何获取网格视图中的超链接文本并将其发送到另一页 - How to get text of hyperlink which is in grid-view and send that text to another page 如何使用资源文件在运行时从网格视图插入和编辑 - How to Insert and edit from the grid-view on run time using resource file 单击按钮后,如何使用复选框工具从网格视图隐藏列? - How can I hide columns from a grid-view using a check-box tool on click of a button? 将图像绑定到集合中的网格视图的有效方法-Windows 8 Metro - Efficient way to bind images to a grid-view from a collection - Windows 8 Metro 将值从模态弹出式扩展器内部的Grid-View传递到父窗体的文本框 - Passing values from Grid-View inside Modal popup Extender to the text box of parent form 如何从rad网格视图填写我的列表? - How can i fill my list from rad grid view? 按列名称显示/隐藏网格视图列 - show/hide grid-view column by column name 所有行在网格视图中都不可见 - All the rows are invisible in the grid view 如何在c#asp.net中的多个XML文件中以网格视图或列表视图显示数据 - how can display data in grid-view or listview from multi XML files in c# asp.net
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM