コントロールを使用してGridView
いますが、ページングが機能していません。コードをステップ実行しているときに、ページをクリックして移動すると、Page_Load
イベントが呼び出されますが、OnPageIndexChanging
イベントは呼び出されません。
<asp:GridView ID="FaxGrid"
runat="server"
BackColor="#FFFFFF"
HeaderStyle-BackColor="#CEDFF2"
HeaderStyle-ForeColor="#316495"
HeaderStyle-Font-Bold="true"
BorderColor="#CEDFF2"
AutoGenerateColumns="false"
OnRowCommand="FaxGridRowCommandHandler"
DataKeyNames="file_id"
AllowPaging="true"
PageSize="10"
PagerSettings-Mode="NumericFirstLast"
OnPageIndexChanging="FaxGrid_PageIndexChanging"
Height="222"
EmptyDataText="No faxes found."
HeaderStyle-Height="35" Width="1470" >
<Columns>
<asp:BoundField HeaderText="File Name" DataField="file_friendly_name" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="125"></asp:BoundField>
<asp:BoundField HeaderText="Dept. Name" DataField="department_name" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="125"></asp:BoundField>
<asp:BoundField HeaderText="Processed" DataField="processed" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="50"></asp:BoundField>
<asp:BoundField HeaderText="First Name" DataField="firstname" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="125"></asp:BoundField>
<asp:BoundField HeaderText="Last Name" DataField="lastname" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="125"></asp:BoundField>
<asp:BoundField HeaderText="DOB" DataField="dob" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="75"></asp:BoundField>
<asp:BoundField HeaderText="Ref. Physician" DataField="referringPhy" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="125"></asp:BoundField>
<asp:BoundField HeaderText="Reported" DataField="reported" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="75"></asp:BoundField>
<asp:BoundField HeaderText="Reported On" DataField="reportedon" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="125"></asp:BoundField>
<asp:BoundField HeaderText="Job Status" DataField="description" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="125"></asp:BoundField>
<asp:TemplateField HeaderText="Fax Options" HeaderStyle-Width="145">
<ItemTemplate>
<asp:Button ID="btnCancel" runat="server" CommandName="CancelFax" CommandArgument='<%# Container.DataItemIndex %>' ToolTip="Cancel and delete fax" Text="Cancel" />
<asp:Button ID="btnResend" runat="server" CommandName="Resend" CommandArgument='<%# Container.DataItemIndex %>' ToolTip="Resend an existing fax." Text="Resend" />
<asp:Button ID="btnSendAsNew" runat="server" CommandName="SendAsNew" CommandArgument='<%# Container.DataItemIndex %>' ToolTip="Send as a new fax." Text="Send as New" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
ここに私のコードビハインドファイルがあります:
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack == false)
{
this.sqlObj = new SqlServer(ConfigurationManager.ConnectionStrings["PdfReceiverConnectionString"].ToString());
this.populateFaxGrid();
}
}
protected void FaxGrid_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
this.FaxGrid.PageIndex = e.NewPageIndex;
this.FaxGrid.DataSource = this.Session["Faxes"];
this.FaxGrid.DataBind();
}
助けていただければ幸いです。