OnPageIndexChanging事件永远不会在GridView上触发

跳蚤

我正在使用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();

}

感谢您的协助。

公平的

您的代码看起来还不错,有时复制粘贴代码无法正确绑定事件,这在我身上发生了很多次。删除事件并再次绑定它。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

WebRTC永远不会在IceCandidate上触发

来自分类Dev

音频事件不会在播放事件上触发jQuery

来自分类Dev

开关盒不会在更改事件上触发

来自分类Dev

tinymce keyup事件不会在Tab键上触发

来自分类Dev

Watchify更新事件永远不会在Virtualbox中触发

来自分类Dev

ASPX Webform - 以编程方式创建的链接按钮永远不会在 UpdatePanel 中触发事件

来自分类Dev

Turbolinks 加载事件永远不会在全新的 Rails 5.1 应用程序中触发

来自分类Dev

Android上的Cordova File API:window.requestFileSystem永远不会在设备上触发

来自分类Dev

<div> 上的点击事件不会在 Firefox 上触发,但在 Chrome 上触发

来自分类Dev

新窗口加载永远不会在 javascript 中触发

来自分类Dev

在Gridview中动态创建的Dropdownlist不会在第二次触发事件

来自分类Dev

OnLongClickListener不会在ViewPager上触发

来自分类Dev

jQuery UI可选事件不会在可拖动事件上触发

来自分类Dev

onNext() 永远不会在 PublishSubject 上被调用

来自分类Dev

引导程序ICheck-Helper不会在更改的事件上触发

来自分类Dev

Bootstrap Select不会在移动设备上触发更改事件

来自分类Dev

文本框点击事件不会在Windows 8上触发鼠标单击

来自分类Dev

jQuery事件$ {document).ready不会在iPhone 5上与移动Safari一起触发

来自分类Dev

InAppBrowser(PhoneGap Build 3.1.0)事件不会在Android 2.3上触发

来自分类Dev

为什么更改输入不会在更改事件上触发?

来自分类Dev

Bootstrap Select不会在移动设备上触发更改事件

来自分类Dev

jQuery-行单击事件不会在新添加的表行上触发

来自分类Dev

为什么“ drop”事件不会在此网页上触发?

来自分类Dev

jQuery change事件不会在指定的选择器上触发

来自分类Dev

动态创建的LinkButton OnClick事件不会在PostBack上触发

来自分类Dev

angular2子组件不会在从父组件触发的后续事件上加载

来自分类Dev

jQuery .change 事件不会在多个相同的类上触发

来自分类Dev

滚动事件不会在可滚动 div 内的 div 上触发

来自分类Dev

React storage 事件不会在写入存储的选项卡上触发

Related 相关文章

  1. 1

    WebRTC永远不会在IceCandidate上触发

  2. 2

    音频事件不会在播放事件上触发jQuery

  3. 3

    开关盒不会在更改事件上触发

  4. 4

    tinymce keyup事件不会在Tab键上触发

  5. 5

    Watchify更新事件永远不会在Virtualbox中触发

  6. 6

    ASPX Webform - 以编程方式创建的链接按钮永远不会在 UpdatePanel 中触发事件

  7. 7

    Turbolinks 加载事件永远不会在全新的 Rails 5.1 应用程序中触发

  8. 8

    Android上的Cordova File API:window.requestFileSystem永远不会在设备上触发

  9. 9

    <div> 上的点击事件不会在 Firefox 上触发,但在 Chrome 上触发

  10. 10

    新窗口加载永远不会在 javascript 中触发

  11. 11

    在Gridview中动态创建的Dropdownlist不会在第二次触发事件

  12. 12

    OnLongClickListener不会在ViewPager上触发

  13. 13

    jQuery UI可选事件不会在可拖动事件上触发

  14. 14

    onNext() 永远不会在 PublishSubject 上被调用

  15. 15

    引导程序ICheck-Helper不会在更改的事件上触发

  16. 16

    Bootstrap Select不会在移动设备上触发更改事件

  17. 17

    文本框点击事件不会在Windows 8上触发鼠标单击

  18. 18

    jQuery事件$ {document).ready不会在iPhone 5上与移动Safari一起触发

  19. 19

    InAppBrowser(PhoneGap Build 3.1.0)事件不会在Android 2.3上触发

  20. 20

    为什么更改输入不会在更改事件上触发?

  21. 21

    Bootstrap Select不会在移动设备上触发更改事件

  22. 22

    jQuery-行单击事件不会在新添加的表行上触发

  23. 23

    为什么“ drop”事件不会在此网页上触发?

  24. 24

    jQuery change事件不会在指定的选择器上触发

  25. 25

    动态创建的LinkButton OnClick事件不会在PostBack上触发

  26. 26

    angular2子组件不会在从父组件触发的后续事件上加载

  27. 27

    jQuery .change 事件不会在多个相同的类上触发

  28. 28

    滚动事件不会在可滚动 div 内的 div 上触发

  29. 29

    React storage 事件不会在写入存储的选项卡上触发

热门标签

归档