I have a gridview that is dynamically filled in - so don't know how many columns in design view.
The columns need to be variable width - this is done in the Row_Created
Dim td As TableCell
For x = 1 To e.Row.Cells.Count - 1
td = e.Row.Cells(x)
td.Width = 70
I came to this after help on EE.
The horizontal scroll is displayed and user can navigate to right on gridview - gridview can't all be fitted on screen, maybe up to XXX columns.
The gridview column titles have link. On clicking the link, there is a postback and values at top of screen are updated according to the column selected detailing all outputs in more user friendly way than a table.
On postback, the horizontal position of scrollbar is forgotten. So the user could have scrolled well to the right off gridview to column 50 say, then on postback the horizontal scrollbar returns to left (column 1), and if the wanted detailed on column 51 they have to scroll all the way to right again.
So I want to maintain horizontal position of scrollbar if possible so user doesn't have to scroll all way to right again.
Had problems with AJAX on this page so don't want that route.
Thanks in advance
<asp:Panel ID="TablePanel" runat="server" Width="800px" Style="overflow: scroll;
border: gray thin solid; border-width: 1px;" BorderColor="#FF6600">
<div id="gridViewDiv" style="width: 5000px; background-color: Silver;">
<asp:GridView ID="GridView1" runat="server" BackColor="white" GridLines="both" BorderStyle="Solid">