繁体   English   中英

单击按钮时显示 jquery 数据表模式对话框不起作用

[英]when button clicked show a jquery datatable modal dialog box not working

我有一个在页面加载时生成的表(“sqlresultsactive”)。 当我单击该页面上的“btnSelectProduct”按钮时,它会显示一个包含该表的模式对话框。

在脚本中,我在前后使用了 jquery

$(document).ready(function () {
    $('#sqlresultsactive').DataTable();
}); 

<asp:GridView ID="sqlresultsactive" runat="server" CssClass="table table-striped table-bordered table-hover" Width="100%" ShowHeaderWhenEmpty="true" ClientIDMode="Static" AutoGenerateColumns="false" Font-Size="10px" OnRowCommand="sqlresultsactive_RowCommand" OnRowDataBound="sqlresultsactive_RowDataBound">
  <Columns>
    <asp:TemplateField HeaderText="Select" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Top" ItemStyle-Width="10%">
      <ItemTemplate>
          <asp:Button ID="ButtonSelect" class="btn btn-success btn-sm p-0" runat="server" Width="60px" CommandName="SwitchProduct" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "webuniqueid") %>' Text="Select"></asp:Button><%--data-dismiss="modal"--%>
          <asp:HiddenField ID="BusinessSegment" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "BusinessSegment") %>' />
      </ItemTemplate>
      <FooterTemplate>
      </FooterTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="Product" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Top" ItemStyle-Width="20%">
      <ItemTemplate>
        <asp:Label ID="lblProduct" runat="server" Text='<%#FormatStringValues(Container.DataItem("programName").ToString, "string")%>' CssClass="nobr"></asp:Label>
      </ItemTemplate>
      <FooterTemplate>
      </FooterTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="Premium Finance" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Top" ItemStyle-Width="20%">
      <ItemTemplate>
        <%--<div id="tdHeadPremiumFinance">--%>
        <div align="center" id="tdPremiumFinance" runat="server">
            <asp:CheckBox ID="PremiumFinanceCheckBox" CssClass="checkbox" Visible="false" runat="server" />
            <asp:Label ID="PremiumFinanceWebUniqueId" runat="server" Text='<%#FormatStringValues(Container.DataItem("webuniqueid").ToString, "string")%>' Visible="false" CssClass="nobr"></asp:Label>
        </div>
        <%--</div>--%>
      </ItemTemplate>
      <FooterTemplate>
      </FooterTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="Company" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Top" ItemStyle-Width="30%">
      <ItemTemplate>
        <span><%#SplitCompany(FormatStringValues(Container.DataItem("company").ToString, "string"), "Company")%></span>
      </ItemTemplate>
      <FooterTemplate>
      </FooterTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="Dealer" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Top" ItemStyle-Width="20%">
      <ItemTemplate>
        <asp:Label ID="dealerLabel" runat="server" Text='<%#FormatStringValues(Container.DataItem("dealernumber").ToString, "string")%>' CssClass="nobr"></asp:Label>
      </ItemTemplate>
      <FooterTemplate>
      </FooterTemplate>
    </asp:TemplateField>
  </Columns>
</asp:GridView>

在文档上并添加了他们的源文件,但它仍然不起作用。 该表已显示,但分页和网格搜索等..未显示

我希望它会在以下更改后工作

$('#sqlresultsactive').DataTable({
  **"dom": "lrBftip",**
});

您可以尝试的另一个选项:单击按钮然后绑定DataTable

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM