Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2003-03-02
3
Medium Priority
?
422 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
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:Michel Sakr
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

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

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

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month13 days, 13 hours left to enroll

580 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