~/DynamicData/Content フォルダーを開くと、ページャーにGridViewPager.ascx
が表示されます。これはすべてのグリッドビューで使用されるページャーであるため、編集できます。分離コードでは、このフィールドが上部に表示されます。
ページ内のページあたりの行数を変更したり、コード ビハインドでデフォルトを設定したりできます。
protected void Page_Load(object sender, EventArgs e)
{
Control c = Parent;
while (c != null)
{
if (c is GridView)
{
_gridView = (GridView)c;
break;
}
c = c.Parent;
}
***_gridView.PageSize = 20;***
}
最初のページ サイズを設定し、リスト ボックスでページ サイズの値を変更してページ自体を編集するには、太字斜体で行を追加します。
<asp:DropDownList ID="DropDownListPageSize" runat="server"
AutoPostBack="true"
CssClass="droplist"
onselectedindexchanged="DropDownListPageSize_SelectedIndexChanged">
<asp:ListItem Value="5" />
<asp:ListItem Value="10" />
<asp:ListItem Value="15" />
<asp:ListItem Value="20" />
</asp:DropDownList>