By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,704 Members | 1,076 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,704 IT Pros & Developers. It's quick & easy.

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

P: 3
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
Share this Question
Share on Google+
1 Reply

P: 1
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") = myBody.scrollTop;
document.all("div_QuoteSave") = 145

if (myBody.scrollTop > 215)
document.all("div_Quote") = myBody.scrollTop;
document.all("div_Quote") = 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.