如何使用bootstrap使ASP gridview响应

问题描述 投票:1回答:1

我遇到了使用bootstrap创建响应式GridView的问题。我在https://www.c-sharpcorner.com/UploadFile/47548d/responsive-grid-view-in-Asp-Net/中看到一个例子?但是主要的问题是如果在gridview中列宽度各不相同,如何设置其md,xs,sm,lg css类以满足gridview的原始宽度样式,是否有好的方法制作那?

asp.net gridview bootstrap-4
1个回答
3
投票

添加必要的引导程序文件

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
  <title>Bootstrap 101 Template</title>

  <!-- Bootstrap -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
  <div class="container">
    <div class="row">
      <div class="col-md-12">
        <div class="table-responsive">
          <asp:GridView ID="grdPDFView" runat="server" AutoGenerateColumns="false" CssClass="table table-bordered table-condensed">
            <Columns>
              <asp:TemplateField HeaderText="Files">
                <ItemTemplate>
                </ItemTemplate>
              </asp:TemplateField>
            </Columns>
          </asp:GridView>
        </div>
      </div>
    </div>
  </div>

  <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <!-- Include all compiled plugins (below), or include individual files as needed -->
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>

</html>
© www.soinside.com 2019 - 2024. All rights reserved.