tags:

views:

192

answers:

2
<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>

When column count is about 20 it looks like perfect (except: I can't see vertical scroll bar before scroll horizontal scrollbar to the right scope)

But when column count is 4 I've got same 2000 width and 500pt for each column and horizontal scroll :-S that's fail.

Is there some way I can control this width ???

thank you.

+1  A: 

I believe that the width property is optional. If you don't set it, the jquery script should take the current table width as a default.

Andre Kraemer
Ha ha ha >_< true. Thank you !
nCdy
You're wellcome! FYI: I recently tried to use the webtoolkit.jscrollable.js script, too. From my experience, it doesn't work with IE 8 (content scrolls, but headers scroll out, too). In addition it didn't work with crhome and safari.
Andre Kraemer
A: 

This doesn't work in IE8 for me either, stuck with compatibility mode for now...

Does anyone know if there is a way to retain the scroll position on postback using this javascript?

aaron