<bdo id='7siaB'></bdo><ul id='7siaB'></ul>

    <small id='7siaB'></small><noframes id='7siaB'>

    <tfoot id='7siaB'></tfoot>

      <i id='7siaB'><tr id='7siaB'><dt id='7siaB'><q id='7siaB'><span id='7siaB'><b id='7siaB'><form id='7siaB'><ins id='7siaB'></ins><ul id='7siaB'></ul><sub id='7siaB'></sub></form><legend id='7siaB'></legend><bdo id='7siaB'><pre id='7siaB'><center id='7siaB'></center></pre></bdo></b><th id='7siaB'></th></span></q></dt></tr></i><div id='7siaB'><tfoot id='7siaB'></tfoot><dl id='7siaB'><fieldset id='7siaB'></fieldset></dl></div>
      <legend id='7siaB'><style id='7siaB'><dir id='7siaB'><q id='7siaB'></q></dir></style></legend>

    1. 按钮单击事件后 DataTable 不渲染 Gridview

      时间:2023-08-26

            <tbody id='3Ai6w'></tbody>
            • <bdo id='3Ai6w'></bdo><ul id='3Ai6w'></ul>
              <i id='3Ai6w'><tr id='3Ai6w'><dt id='3Ai6w'><q id='3Ai6w'><span id='3Ai6w'><b id='3Ai6w'><form id='3Ai6w'><ins id='3Ai6w'></ins><ul id='3Ai6w'></ul><sub id='3Ai6w'></sub></form><legend id='3Ai6w'></legend><bdo id='3Ai6w'><pre id='3Ai6w'><center id='3Ai6w'></center></pre></bdo></b><th id='3Ai6w'></th></span></q></dt></tr></i><div id='3Ai6w'><tfoot id='3Ai6w'></tfoot><dl id='3Ai6w'><fieldset id='3Ai6w'></fieldset></dl></div>

              <small id='3Ai6w'></small><noframes id='3Ai6w'>

              <legend id='3Ai6w'><style id='3Ai6w'><dir id='3Ai6w'><q id='3Ai6w'></q></dir></style></legend>
                <tfoot id='3Ai6w'></tfoot>
                本文介绍了按钮单击事件后 DataTable 不渲染 Gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                在创建页面时,一切正常,但是当我单击按钮以显示所选行时,我的网格视图不会呈现为数据表.我需要做什么来解决这个问题或我做错了什么?

                In my page when it's creating, everything is working fine but when I am clicking on the button to show the selected row, then my grid view is not rendering as a datatable. What I need to do to fix this or what I am doing wrong?

                我的脚本:

                <script type="text/javascript">
                        $(function () {
                            $('[id*=gvTest]').prepend($("<thead></thead>").append($(this).find("tr:first"))).DataTable({
                                "responsive": true,
                                "sPaginationType": "full_numbers",
                                
                                 
                            });
                        });
                        $(document).ready(function () {
                
                            var table = $('#gvTest').DataTable();
                            $('#gvTest tbody').on( 'click', 'tr', function () {
                            $(this).toggleClass('selected');
                            });
                              
                      
                            $('#btnRead').click(function () {
                           var ids = $.map(table.rows('.selected').data(), function (item) {
                               return item[0]
                                 });               
                            });
                           
                    } );
                    </script>
                

                我的网格:

                <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>
                   <asp:UpdatePanel ID="updatePanel" runat="server">
                     <ContentTemplate>
                
                     <asp:GridView  ID="gvTest" Width="100%" runat="server"  AutoGenerateColumns="False" >
                      <Columns>
                           <asp:BoundField  DataField="PatientID"  HeaderText="Patient ID" >
                           </asp:BoundField>
                           <asp:BoundField  DataField="PatientName"  HeaderText="PatientName" >
                           </asp:BoundField>
                           <asp:BoundField  DataField="Age"  HeaderText="Age" >
                           </asp:BoundField>
                           <asp:BoundField  HeaderText="Sex" DataField="Sex"  >
                           </asp:BoundField>
                           <asp:BoundField  HeaderText="Mod" DataField="Modality"  >                                 
                      </Columns>
                    </asp:GridView>
                </ContentTemplate>
                </asp:UpdatePanel>
                

                当我的页面被创建时:

                一切正常,但是当我点击一个按钮时,就会发生这种情况:

                Everything is working fine, but when I click a button then this happens:

                我现在需要做什么来解决这个问题?

                What do I need to do now to fix this problem ?

                推荐答案

                在使用了很多其他代码后,我没有得到合适的解决方案,所以我在页面加载时使用了它,它工作正常

                after using a lots of others code i did'nt get a proper solution so i used this on my page load and its working fine

                gvTest.UseAccessibleHeader = true;
                //adds <thead> and <tbody> elements
                gvTest.HeaderRow.TableSection =
                TableRowSection.TableHeader;
                

                这篇关于按钮单击事件后 DataTable 不渲染 Gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:脚本在 dotnet WebBrowser 控件中运行速度较慢 下一篇:在 ASP.NET 中选择要上传的多个文件(最好不使用

                相关文章

                最新文章

                • <bdo id='oEUq5'></bdo><ul id='oEUq5'></ul>

                  <small id='oEUq5'></small><noframes id='oEUq5'>

                  <i id='oEUq5'><tr id='oEUq5'><dt id='oEUq5'><q id='oEUq5'><span id='oEUq5'><b id='oEUq5'><form id='oEUq5'><ins id='oEUq5'></ins><ul id='oEUq5'></ul><sub id='oEUq5'></sub></form><legend id='oEUq5'></legend><bdo id='oEUq5'><pre id='oEUq5'><center id='oEUq5'></center></pre></bdo></b><th id='oEUq5'></th></span></q></dt></tr></i><div id='oEUq5'><tfoot id='oEUq5'></tfoot><dl id='oEUq5'><fieldset id='oEUq5'></fieldset></dl></div>
                  1. <legend id='oEUq5'><style id='oEUq5'><dir id='oEUq5'><q id='oEUq5'></q></dir></style></legend>
                    <tfoot id='oEUq5'></tfoot>