?
Solved

ASP.net, Goto special component instead of top of the webpage

Posted on 2003-03-02
3
Medium Priority
?
408 Views
Last Modified: 2006-11-17
I would like to ask after jump to a webpage, a would like to jump to a special component (say a textbox at the middle of the page) instead of the top of the webpage, how to do so?

Traditionally, we can use <a name> as an anchor and goto that part while link to it, however, in ASP.net, we can set the location of the components and can't use this method to specify the location we want to goto.

Thanks!
0
Comment
Question by:cstcfu
[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
3 Comments
 

Accepted Solution

by:
Ized earned 200 total points
ID: 8055453
You should use the ClientID property of your asp.net component and the insert a javascript command on the page that focuses the browser on to your component.

Try the following in page load:

If (Not Me.IsStartupScriptRegistered("Startup")) Then
Me.RegisterStartupScript("Startup", TextBox1.ClientID & ".setfocus()")
End If

This would create a javascript command that is executed when page is loaded and will have the page put focus on the component called TextBox1 (by using clientID).
0
 
LVL 20

Expert Comment

by:Silvers5
ID: 8055459
you still can..
also you can se the focus of the component by adding a similar javascript code to your page
response.write("<script language=JavaScript>" & VBCRLF  & "document.FormName.ObjectName.focus();" & VBCRLF & "</script>")


don't forget that javascript is case sensetive
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9650638
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by Ized

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

TheLearnedOne
EE Cleanup Volunteer
0

Featured Post

RHCE - Red Hat OpenStack Prep Course

This course will provide in-depth training so that students who currently hold the EX200 & EX210 certifications can sit for the EX310 exam. Students will learn how to deploy & manage a full Red Hat environment with Ceph block storage, & integrate Ceph into other OpenStack service

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
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…
Suggested Courses

766 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