Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I prevent an ASP.NET page from jumping upon postback?

Posted on 2006-06-23
14
Medium Priority
?
1,456 Views
Last Modified: 2008-01-09
I have a radio button list that, when selected, immedietly does a post back and reveals another radio button list. That list changes depending on what the user selected on the first radio button list.

This works fine except for one aggravating problem. Every time it does postback the user is placed back at the top of the page. How do I make this page so the user's page doesn't move?
0
Comment
Question by:M3hcSS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
  • +4
14 Comments
 
LVL 2

Author Comment

by:M3hcSS
ID: 16971693
I mean to say, I don't want the user to scroll down the page every time they do a selection.
0
 
LVL 5

Assisted Solution

by:Collindsouza
Collindsouza earned 240 total points
ID: 16971796
You need to show hide the Second Set of radio button using Javascript.. Assuming that your using DIV's you need to write client side Javascript that on click on Radio Button A.. will show/hide radio Button B
0
 
LVL 1

Expert Comment

by:EnolaKotrotsos
ID: 16972206
put the buttons in an iFrame container or use AJAX (.NET has the Atlas implementation- search google)
Marco
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 35

Expert Comment

by:mrichmon
ID: 16972230
Basically you cannot allow asp to do this for you.  Instead you need to use client side code (javascript as mentioned above) to manually do this.  You don't need AJAX for simply hiding and showing additional radio button groups.  But if the content needs to look up information in the database then AJAX could be used.
0
 
LVL 2

Author Comment

by:M3hcSS
ID: 16972438
It's not possible to use something inside Visual Studio in order to anchor the page?
0
 
LVL 35

Accepted Solution

by:
mrichmon earned 260 total points
ID: 16972523
No.

You can use javascript to scroll the page back down to the radio location (again you are using javascript), but that is not a very nice user interface.  Basically you should not need to post the page just because the user changes the radio selection.  Therefore you should have javascript handle this.
0
 
LVL 2

Author Comment

by:M3hcSS
ID: 16972846
Ok, let me try to figure out this javascript thingy (I haven't used javascripting in conjunction with a .NET page), and then I shall distribute the points accordingly.

Thanks for your time. I appreciate it.
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 16973232
Let us know if you have specific questions when trying to figure it out.

One thing you may run into is that you may have to access the radio buttions as html elements and not hte .NET controls.
0
 
LVL 5

Expert Comment

by:Collindsouza
ID: 16973245
True..

You need to use Html Radio button Controls.. with runat="server" attribute

Cheers,
Collin
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 16973412
Yes that is what I was referring to....

Also on the backend you will access as:
HtmlInputRadioButton

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconASPSyntaxForHTMLControls.asp
0
 
LVL 4

Expert Comment

by:gregg1ep00
ID: 16973749
If you're using ASP.NET 2.0, have you tried setting the Page.MaintainScrollPositionOnPostBack property to true?

If you're using ASP.NET 1.1, you can set the SmartNavigation attribute in the <%@ Page %> directive to true.
0
 
LVL 3

Expert Comment

by:rinksno1
ID: 16974621
gregg1ep00 solution will work!!......
0
 
LVL 15

Expert Comment

by:justinbillig
ID: 16984585
smartnavigation is IE only
0
 
LVL 2

Author Comment

by:M3hcSS
ID: 16985866
<<<If you're using ASP.NET 1.1, you can set the SmartNavigation attribute in the <%@ Page %> directive to true.

I set this attribute to "true" yet the page still jumps to the top. I'm using IE 6.0 with asp.net 1.1. It would seem that it should work.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question