我在页面中有一个GridView asp服务器控件,我已将其AllowPaging设置为true。现在,我想循环到整个行,但它只是迭代到我定义的PageSize的数量。如何循环具有AllowPaging属性的整个GridView设置为true?
这里是ASP代码:
<asp:GridView ID="gvName" runat="server" AllowPaging="True" PageSize="5" AutoGenerateColumns="True"></asp:GridView>
这里是后面的代码:
List<string> list = new List<String>();
for(int x = 0; x <= 9; x++)
{
list.Add("Name " + (x + 1).ToString());
}
gvName.DataSource = list;
gvName.DataBind();
foreach(GridViewRow row in gvName.Rows)
{
// gvName.Rows.Count only returns 5 instead of the total number of its record that is 10
}
预先感谢任何形式的答案。
你想要取什么?您可以迭代该信息的列表。 –