470,817 Members | 1,445 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,817 developers. It's quick & easy.

maintain scroll position on postback in dynamically generated page in ASP.NET1.1+C#

I have one .aspx file which is generating whole page dynamically by taking all the HTML tags from SQL SERVER 2000 database . This .aspx is also containing one user control ( which contains two dropdownlist box ).On selection of some Text in one dropdownlist box , whole page refreshes because autopostback="true" for dropdownlist box . Now after postback , i want to maintain the scroll position . for this i used following options :

1) SmartNavigation="true"
2) addition of third party dll
3) javascript

But all the above options were not working in this dynamically generated page .
So, could you please give me solution for this problem .
Please reply ASAP because i am in urgent need of this solution.
Aug 7 '06 #1
1 4442
The following piece of code might work for you

<script language="javascript" event="onscroll" for="window">
return window_onscroll()
<script language="javascript" event="onload" for="window">
return window_onload()
<script language="javascript">
function window_onscroll()
document.frmQuoteDetails.hdnTopPos.value = myBody.scrollTop;

if (myBody.scrollTop > 145)
document.all("div_QuoteSave").style.top = myBody.scrollTop;
document.all("div_QuoteSave").style.top = 145

if (myBody.scrollTop > 215)
document.all("div_Quote").style.top = myBody.scrollTop;
document.all("div_Quote").style.top = 215

function window_onload()
window.scroll(9999,document.frmQuoteDetails.hdnTop Pos.value);
//document.frmQuoteDetails.hdnTopPos.value = "";

Feb 11 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by GrantS | last post: by
3 posts views Thread by rmunson8 | last post: by
1 post views Thread by Wayne Sepega | last post: by
7 posts views Thread by Lit | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.