![](/img/trans.png)
[英]How to get value in drop down-list from parent Grid-view when Click Edit on child grid-view?
[英]Cannot get all rows from Rad Grid-View with DataPager
這是我的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行)?
固定!
使用此鏈接,只需在循環開始和結束時添加AllowPaging=false and true
。
RadGrid1.AllowPaging = false;
RadGrid1.Rebind();
foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
{
}
RadGrid1.AllowPaging = true;
RadGrid1.Rebind();
這段代碼可以通過Paging從Data GridView獲取所有行!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.