Jquery Rowcommand未为gridview中的linkbutton触发?

Jquery Rowcommand未为gridview中的linkbutton触发?,jquery,asp.net,css,gridview,Jquery,Asp.net,Css,Gridview,我有一个带有链接按钮的gridview。我使用jquery和css为linkbutton设置了一个lightbox 链接按钮源代码 <asp:TemplateField HeaderText="Course" ItemStyle-CssClass="course" HeaderStyle-CssClass="course"> <ItemTemplate> <asp:LinkButton ID="

我有一个带有链接按钮的gridview。我使用jquery和css为linkbutton设置了一个lightbox

链接按钮源代码

<asp:TemplateField HeaderText="Course" ItemStyle-CssClass="course" HeaderStyle-CssClass="course">
                <ItemTemplate>
                    <asp:LinkButton ID="Course_Name" runat="server"   Text='<%# Eval("Course_Name__c") %>' ForeColor="#666699" CommandName="course" CommandArgument='<%# ((GridViewRow) Container).RowIndex %>'  ></asp:LinkButton>
                </ItemTemplate>
                <HeaderStyle Font-Bold="True" />

                <HeaderStyle HorizontalAlign="Center"/>
                <ItemStyle CssClass="course"></ItemStyle>
            </asp:TemplateField>
剧本是,

    <script type="text/javascript">
    $(document).ready(function () {
        $('.popup-with-zoom-anim').magnificPopup({
            type: 'inline',

            fixedContentPos: false,
            fixedBgPos: true,

            overflowY: 'auto',

            closeBtnInside: true,
            preloader: false,

            midClick: true,
            removalDelay: 300,
            mainClass: 'my-mfp-zoom-in'
        });

        $('.popup-with-move-anim').magnificPopup({
            type: 'inline',

            fixedContentPos: false,
            fixedBgPos: true,

            overflowY: 'auto',

            closeBtnInside: true,
            preloader: false,

            midClick: true,
            removalDelay: 300,
            mainClass: 'my-mfp-slide-bottom'
        });
    });
</script>

$(文档).ready(函数(){
$('.popup with zoom anim')。放大弹出({
键入:“内联”,
fixedContentPos:false,
fixedBgPos:true,
溢出:“自动”,
closebtnside:true,
预加载程序:false,
点击中键:对,
拆除延迟:300,
mainClass:“我的mfp放大”
});
$('.popup with move anim')。放大弹出({
键入:“内联”,
fixedContentPos:false,
fixedBgPos:true,
溢出:“自动”,
closebtnside:true,
预加载程序:false,
点击中键:对,
拆除延迟:300,
mainClass:“我的mfp滑底”
});
});

但是rowcommand没有启动,所以lightbox没有显示任何数据。感谢您的帮助

这种行为可能有不止一个原因。执行以下检查:

  • 不要在
    Page\u Load
    事件中的回发上绑定您的
    GridView
    。意思是说,如果您是从代码隐藏绑定GridView,则仅第一次绑定它::

    如果((!Page.IsPostback)){ GridView1.DataBind(); }

  • 对于
    GridView

  • 最后一个选项是,
    OnRowCommand
    属性可能缺失/不存在 在gridView标记中定义。确保已为行命令事件定义了事件处理程序,如下所示:

  •     <script type="text/javascript">
        $(document).ready(function () {
            $('.popup-with-zoom-anim').magnificPopup({
                type: 'inline',
    
                fixedContentPos: false,
                fixedBgPos: true,
    
                overflowY: 'auto',
    
                closeBtnInside: true,
                preloader: false,
    
                midClick: true,
                removalDelay: 300,
                mainClass: 'my-mfp-zoom-in'
            });
    
            $('.popup-with-move-anim').magnificPopup({
                type: 'inline',
    
                fixedContentPos: false,
                fixedBgPos: true,
    
                overflowY: 'auto',
    
                closeBtnInside: true,
                preloader: false,
    
                midClick: true,
                removalDelay: 300,
                mainClass: 'my-mfp-slide-bottom'
            });
        });
    </script>