我现在的方法用的是Gridview 72般绝技中的CSS控制.
我加上一个Panel用来实现纵横向的滚动.当Gridview的栏位比较少时,只有纵向需要拖动,一切都还好~
可是~当Gridview的栏位多起来时,表头就超出了Panel.横向拖动只拖动了Item部分,表头不随着滚动条而动,大刺刺的超出了panel.
请教解决办法.

解决方案 »

  1.   

    这个是我用过的:<script type="text/javascript">
    function s()
    {
     var t = document.getElementById("<%=GridView1.ClientID%>");
     var t2 = t.cloneNode(true)
     for(i = t2.rows.length -1;i > 0;i--)
     t2.deleteRow(i) 
     t.deleteRow(0) 
     a.appendChild(t2)
    }
    window.onload = s
    </script>
    ------------------------------------------------------------------------
    <div style="overflow-y: scroll; height: 200px">
              <asp:GridView ID="GridView1" runat="server" EnableViewState="true" AllowPaging="true" PageSize="12" AutoGenerateColumns="False"
               BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" Font-Size="13px"  style="left: 1px; position: relative; top: 0px; z-index: 100; width:100%" OnPageIndexChanging="GridView1_PageIndexChanging" OnRowDataBound="GridView1_RowDataBound">
                <Columns> 
                   <asp:TemplateField>
                        <ItemTemplate>
                            <input name="chk" type="checkbox" value="<%#Eval("InfoID")%>" />
                        </ItemTemplate>
                    </asp:TemplateField>      
                    <asp:BoundField DataField="InfoID" HeaderText="资讯ID" ItemStyle-Width="20px"/>     
                    <asp:BoundField DataField="Title" HeaderText="资讯标题"/> 
                    <asp:BoundField DataField="Source" HeaderText="资讯来源"/>
                    <asp:BoundField DataField="CreateTime" HeaderText="发布日期" ItemStyle-Width="60px"/>
                    <asp:BoundField DataField="ColumnName" HeaderText="所属栏目"/>
                </Columns>
                  <FooterStyle BackColor="White" ForeColor="#000066" />
                <RowStyle ForeColor="#000066" />
                <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" CssClass="Freezing"/>
            </asp:GridView>       
             </div>
      

  2.   

    是参考http://www.tzwhx.com/newOperate/html/1/11/111/490.html
      

  3.   

    ·双线主机 100M/35元/年,免费送数据库(自选MY/MSSQL) 
    ·详情请访问:http://www.515dns.com