<asp:Panel ID="Panel2" style="width:720px; border-style: outset; border-width: 4px; " runat="server" ScrollBars="Horizontal">
<script src="Scripts/jquery-1.2.6.js" type="text/javascript"></script>
<script src="Scripts/webtoolkit.jscrollable.js" type="text/javascript"></script>
<script src="Scripts/webtoolkit.scrollabletable.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
jQuery('#<%=GridView2.ClientID%>').Scrollable(400, 2000);
});
</script>
<asp:GridView ID="GridView2" runat="server"
DataSourceID="SqlDataSource1" OnPreRender="GridView2_PreRender"
onrowcreated="GridView1_RowCreated" Width="100%"
ondatabound="GridView2_DataBound" CellPadding="4" ForeColor="#333333"
GridLines="both">
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
当列数大约为20时,它看起来很完美(除了: 我无法看到垂直滚动条,然后将水平滚动条滚动到右侧范围 )
但是当列数为4时,我的每个列和水平滚动的宽度和宽度都是相同的2000宽度:-S失败了。
有什么方法可以控制这个宽度???
谢谢。答案 0 :(得分:1)
我相信width属性是可选的。如果不设置它,jquery脚本应该将当前表宽度作为默认值。