如何使用scrollable修复DataGrid标头 [英] how to fix DataGrid Header with scrollable

查看:73
本文介绍了如何使用scrollable修复DataGrid标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





如何修复DataGrid标题,



我尝试了很多方法不工作正如预期的那样,请建议我如何使用固定标题生成DataGrid,

Hi,

How to fix DataGrid Header with ,

I tried many ways not working as expected, please suggest me the ways how to make DataGrid with fixed header,

推荐答案

将Header和Gridview放在两个具有相同宽度的seprate div中,如下所示

Put the Header and Gridview in two seprate div having same width like below
<div style=" background-color:Green;  <br mode=" hold=" />        height:30px;width:600px; margin:0;padding:0">
       <table cellspacing="0" cellpadding="0" rules="all" border="1" id="tblHeader">
        style="font-family:Arial;font-size:10pt;width:600px;color:white;
        border-collapse:collapse;height:100%;">
           <tr>
              <td style="width:150px;text-align:center">CustomerID</td>
              <td style="width:150px;text-align:center">City</td>
              <td style="width:150px;text-align:center">Country</td>
              <td style="width:150px;text-align:center">PostalCode</td>
           </tr>
       </table>
       </div>
       <div style="height:200px; width:600px; overflow:auto;">
       <asp:gridview id="GridView1" runat="server" xmlns:asp="#unknown">
           AutoGenerateColumns = "false" Font-Names = "Arial" ShowHeader = "false"
           Font-Size = "11pt" AlternatingRowStyle-BackColor = "#C2D69B" >
          <columns>
           <asp:boundfield itemstyle-width="150px" datafield="CustomerID" />
           <asp:boundfield itemstyle-width="150px" datafield="City" />
           <asp:boundfield itemstyle-width="150px" datafield="Country" />
           <asp:boundfield itemstyle-width="150px" datafield="PostalCode" />
          </columns>
       </asp:gridview>
       </div>


试试这个 http://www.dotnetspider.com/resources/45021-Scrollable-GridView-using-JQuery.aspx [ ^ ]


这篇关于如何使用scrollable修复DataGrid标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆