473,804 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Ajax Problem: UpdatePanel with dropdownlist jumps to bottom of the page

I have an UpdatePanel with a DropDownList. Everytime I select a new
item on the DropDownList, the UpdatePanel refreshes and the page jumps
to the bottom. I want it to go back to the top of the page, any ideas
what the problem is?
Everything ASP.NET 2.0
------------------------------------
http://funkylist.com/ViewList.aspx?i...ng+ASP.NET+2.0

Mar 3 '07 #1
2 4438
Yep, by default ASP.NET AJAX retains the current document scroll
position (which is a good thing since 95% of the time end users would
want that). In your case, you can wire the endRequest event of the
AJAX request and scroll to top using something similar to:

<asp:ScriptMana ger ID="ScriptManag er1" runat="server"
EnablePartialRe ndering="true"/>

<script type="text/javascript">
var prm = Sys.WebForms.Pa geRequestManage r.getInstance() ;
prm.add_endRequ est(OnEndReques t);

function OnEndRequest(se nder,args)
{
window.scrollTo (0,0);
}
</script>

Just make sure the javascritp code is below ScriptManager tag
(otherwise a javascript not defined error will occur)

Mar 3 '07 #2
On Mar 3, 11:35 am, "Kevin" <Kevin.News...@ gmail.comwrote:
Yep, by default ASP.NET AJAX retains the current document scroll
position (which is a good thing since 95% of the time end users would
want that). In your case, you can wire the endRequest event of the
AJAX request and scroll to top using something similar to:

<asp:ScriptMana ger ID="ScriptManag er1" runat="server"
EnablePartialRe ndering="true"/>

<script type="text/javascript">

var prm = Sys.WebForms.Pa geRequestManage r.getInstance() ;
prm.add_endRequ est(OnEndReques t);

function OnEndRequest(se nder,args)
{
window.scrollTo (0,0);
}
</script>

Just make sure the javascritp code is below ScriptManager tag
(otherwise a javascript not defined error will occur)

Thanks Kevin for replying. It work great in IE, but in firefox the
first time you try it, it still jumps to the bottom of the page. The
funny thing is that the second and other times you try it, it works.
Any ideas why it doesn't go to the top the first time the page loads?

Thanks

Everything ASP.NET 2.0
------------------------------------
http://funkylist.com/ViewList.aspx?i...ng+ASP.NET+2.0

Mar 5 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2427
by: Rahul | last post by:
I am trying the following thing in AJAX <atlas:ScriptManager ID="scriptmanager1" runat="Server" EnablePartialRendering="true" /> <asp:DropDownList ID="cmbBranchname" cssclass="Combostyle" runat="server" /> <br/> <atlas:UpdatePanel ID="panel1" runat="server" UpdateMode="Conditional" > <ContentTemplate>
1
4855
by: mbruyns | last post by:
i have been trying (and sometimes succeeding) to use the modalpopupextender to show various panels of controls on my asp pages. the strange problem that i keep on running into is that sometimes it works, displaying an awesome popup, while other times, it doesn't show a popup at all, but rather just page posts back and the panel becomes visible at the bottom of the page (where it is situated in the designer). what is even stranger to me is that...
0
3525
by: Med | last post by:
Hi, I have two dropDown lists ddlCars and ddlModels. ddlCars AutoPostBack="true" to populate the ddlModels when a car is selected. If the page is not valid (i.e. user left a mandatory textbox blank and presented by ValidatorCalloutExtender message when attempting to submit), selecting an item in ddlCars DOES NOT postback the first time, but it will the second time. Cars_SelectedIndexChanged should postback regardless of valid/invalid...
2
3349
by: =?Utf-8?B?Q2hyaXMgRmluaw==?= | last post by:
I have a general question regarding VS2008 and Ajax Toolkit 3.5. Currently I have a dropdownlist populated from the database. When the user selects and item, the OnSelectedIndexChanged event fires (does a postback to the server) and then loads the selected item's value into an asp:textbox control. Using the Ajax toolkit, I'd like to perform this same functionality, but without the entire page posting back. I'm looking for suggestions...
4
6056
by: pablorp80 | last post by:
Hello, Here is what I need: I need the focus and the cursor set to a textbox named txtGT, every time no matter if it is the first page load or whether it is a postback. Here is the problem: I am using AJAX and MasterPages as well as an update panel, the textbox is in a panel. I have tried to do it using different java scripts but I can't get it to work because I am not using asp forms, instead I am using Containers. Here is my code:...
7
3318
by: Jim in Arizona | last post by:
I'm brand new at ajax. In fact, about 20 minutes ago was the first time I got it to work. The problem I'm having on another page did not work, however. I'm running into the following error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server...
1
2065
by: raam | last post by:
Hi, I have ajax tab container with 6 tabs in it. I need to validate each tab contents separately and the validtaion summary must be separate for each tab. i cannot do that only one summary is being accesed. i also tried with validationgroup. Finlly i want each tab content to be validated and the content should accept the inputs.If any errors the message must display in summary separately. Here are 2 of my tabs.Dont feel bore pls let me...
3
3835
by: =?Utf-8?B?Y21lZWsxXzE5OTk=?= | last post by:
Hello, On a webpage, create an UpdatePanel with two DropDownLists. Set AutoPostBack of DropDownList1 to true. In the SelectedIndexChanged method, refill DropDownList2 and set the focus to DropDownList1 using the ScriptManager SetFocus method. Use the Visual Studio debugger. Set a breakpoint on in the (!IsPostBack) part of the PageLoad method. Start the web application and continue after the breakpoint has been reached.
3
1483
by: SAL | last post by:
Hello, I'm using vs2005 and ajax exentions 1.0.61025.0. I have a page with a Gridview control that's inside of an update panel. I also have a DetailsView on this page inside of another update panel. The Detailsview handles the inserting of records into the Gridview. The page is behaving as expected except the ItemInserting event (and there the inserting) is being called twice. I have logic in place that is handling this but it would be...
0
10343
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9169
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7633
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5529
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5668
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4306
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.