The SmartNavigation=”true” will retain the position of the scroll bar of the page on every postback. I tried with a simple code as below
<body>
<form id="form1" runat="server">
<div runat="server" id="Div1">
<table>
<tr>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</td>
</tr>
.
.
.
.
.
<tr>
<td>
<asp:TextBox ID="TextBox35" runat="server"></asp:TextBox>
</td>
</tr>
</table>
</div>
<div>
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
</form>
</body>
In the above code, I have used about 35 textboxes in one DIV tag, this will produce the scrollbar on the page. Now, make SmartNavigation=”true” for the Page. Run It. Now, Scroll to the bottom most position of the page, enter your name in last textbox and click the Botton. The page will be posted back and you will find that the
position of the scrollbar is retained (at the bottom).
If you remove SmartNavigation=”true” from the Page Directive, the scrollbar position will not be retained.
Now, do a small change with the above code.
Just replace “<div runat="server" id="Div1">”
With “<div runat="server" id="Div1" style="height:500px; overflow:auto;">”
The above replaced line will set the
Height of the Div tag to 500px and Overflow:auto will provide scrollbar to the Div tag. Now again Run it.
Perform the same action, scroll down to the bottom most position, enter your name in the last textbox and click the button. The page will be posted back but now the position of the scrollbar is not retained.
This exactly is my requirement:
How to retain the scrollbar position of the Div tag scrollbar?
Regards
Tajinder
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com