Javascript 使用Repeater控件和Datatable Jquery插件创建不需要的空间

Javascript 使用Repeater控件和Datatable Jquery插件创建不需要的空间,javascript,c#,jquery,visual-studio,datatables,Javascript,C#,Jquery,Visual Studio,Datatables,我对代码是新手。 我使用repeater控件绑定来自ms sql server的数据,以连接datatable jQuery插件 我对中继器创建的布局有问题。 若我有一个大型数据库,中继器将在表上方创建不必要的空间 这是我的页面和代码 在下图中,我拖动了一个由repeater控件创建的行空间,下面显示了datatable $(文档).ready(函数(){ $(“#示例”).DataTable(); }); 不 图纸编号 问题 简称 站 设计师 图纸说明 零件号 地位 为什么您有两个不同版

我对代码是新手。
我使用repeater控件绑定来自ms sql server的数据,以连接datatable jQuery插件

我对中继器创建的布局有问题。
若我有一个大型数据库,中继器将在表上方创建不必要的空间

这是我的页面和代码

在下图中,我拖动了一个由repeater控件创建的行空间,下面显示了datatable



$(文档).ready(函数(){
$(“#示例”).DataTable();
});
不
图纸编号
问题
简称
站
设计师
图纸说明
零件号
地位

为什么您有两个不同版本的jquery?拿出bootstrap.css,看看空间是否消失。我怀疑问题在于中继器我有一个没有引导的代码,但响应是相同的。所以,我假设问题来自中继器。我不知道如何修复它。注释掉$(“#示例”).DataTable();看看原始HTML,确保没有什么奇怪的地方,看看表的结尾在哪里为什么有两个不同版本的jquery?拿出bootstrap.css,看看空间是否消失了。我怀疑问题是repeateri有一个没有引导的代码,但响应是一样的。所以,我假设问题来自中继器。我不知道如何修复它。注释掉$(“#示例”).DataTable();查看原始HTML,确保没有任何奇怪的地方,并查看表的最终位置
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class dFixtureRR : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {
    if (!this.IsPostBack)
    {
      this.BindRepeater();
    }
  }

  private void BindRepeater()
  {
    string constr = ConfigurationManager.ConnectionStrings["AEdatabaseConnectionString"].ConnectionString;
    using (SqlConnection con = new SqlConnection(constr))
    {
      using (SqlCommand cmd = new SqlCommand("SELECT * FROM FixtureRR", con))
      {
        using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
        {
          cmd.CommandType = CommandType.Text;
          DataTable dt = new DataTable();
          sda.Fill(dt);
          Repeater1.DataSource = dt;
          Repeater1.DataBind();
        }
      }
    }
  }
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="dFixtureRR.aspx.cs" Inherits="dFixtureRR" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head runat="server">
    <link href="Contend/css/jquery.dataTables.min.css" rel="stylesheet" />
    <link href="Contend/css/bootstrap.min.css" rel="stylesheet" />
    <script src="Contend/js/jquery-3.2.1.min.js"></script>
    <script src="Contend/js/jquery-1.12.4.js"></script>
    <script type="text/javascript" src="Contend/js/jquery.dataTables.min.js"></script>
    <script type="text/javascript">
      $(document).ready(function () {
        $('#example').DataTable();
      });
    </script>
    <title></title>
  </head>

  <body>
    <form id="form1" runat="server">
      <div class="container-fluid">
        <table id="example" class="display table-bordered" cellpadding="0" width="100%" >
          <thead>
            <tr>
              <th>
                No
              </th>
              <th>
                Drawing_Number
              </th>
              <th>
                Issue
              </th>
              <th>
                Short_Title
              </th>
              <th>
                Station
              </th>
              <th>
                Designer
              </th>
              <th>
                Drawing_Description
              </th>
              <th>
                Part_Number
              </th>
              <th>
                Status
              </th>
            </tr>
          </thead>
          <tbody>
            <asp:Repeater runat="server" ID="Repeater1" >
              <ItemTemplate>
                <tr>
                  <td>
                    <%#Eval("No")%>
                  </td>
                  <td>
                    <%#Eval("Drawing_Number") %>
                  </td>
                  <td>
                    <%#Eval("Issue") %>
                  </td>
                  <td>
                    <%#Eval("Short_Title") %>
                  </td>
                  <td>
                    <%#Eval("Station") %>
                  </td>
                  <td>
                    <%#Eval("Designer") %>
                  </td>
                  <td>
                    <%#Eval("Drawing_Description") %>
                  </td>
                  <td>
                    <%#Eval("Part_Number") %>
                  </td>
                  <td>
                    <%#Eval("Status") %>
                  </td>
                </tr>
              </ItemTemplate>
            </asp:Repeater>
          </tbody>
        </table>
      </div>
    </form>

  </body>
</html>