472,983 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,983 software developers and data experts.

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

Hi,
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 4548
The following piece of code might work for you

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

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

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

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

}
Feb 11 '08 #2

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

Similar topics

2
by: GrantS | last post by:
I am trying to convert the VB.Net code example povided by http://authors.aspalliance.com/JimRoss/Articles/MaintainScrollPos.aspx into C# (ASP.Net)without success. No errors are thrown in the VB...
8
by: ed | last post by:
Does anyone know if ASP.NET 2.0 is going to incorporate "maintain scroll position on postback" in non-IE browsers like Firefox? This seems like an often requested feature on these newsgroups...
5
by: JezB | last post by:
There are a few references on the net about how to restore a page's scroll position over a postback. This is a simple one which works for me: eg....
3
by: rmunson8 | last post by:
I have added Panel control to a web page which contains a GridView. The Panel's ScrollBars property is set to auto. When I select the Select CommanField button for a row (which obviously causes a...
1
by: Wayne Sepega | last post by:
Ultimately what I need is a way to remember the scroll position of the form on a post back. I have a button that posts back to the current form and if there are no errors the form is reproduced, I...
0
by: Keithb | last post by:
The maintain scroll position on postback feature works as expected with my site running under localhost on the development machine. When the files are posted to an IIS 6.0 web server running on a...
7
by: Lit | last post by:
Hi, How can I capture the vertical scroll bar position for a Listbox. I have a Listbox of 100 items + when I click on it I post back remove the item selected. After returning to the client...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.