Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 7th, 2006, 02:14 AM
Authorized User
 
Join Date: Mar 2006
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Focus after postback

Focus after postback

How can i set focus or send the cursor to a specific control on the page after postback?
let say that i have a textbox and a button next to it then another textbox below.

------------ -------
Text box button
------------ -------

------------
Text box
------------

after i click the button (server side) i want to send the cursor to the textbox below..
I don't want to start from the beggining when i press Tap..

Can anyone help me please?

__________________
Happy Programming :)
 
Old March 7th, 2006, 04:57 AM
Registered User
 
Join Date: Feb 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi i think you just have to give "tabindex" in properties of button and text box.Try to give the tabindex for them in an order.This might work just try.

Regards
S.G.Sandeep:)

 
Old March 7th, 2006, 12:03 PM
RGB RGB is offline
Authorized User
 
Join Date: Mar 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Me.SetFocus(Me.OGDatePicker1)

 Private Sub SetFocus(ByVal ctrl As System.Web.UI.Control)
        'set focus to first name on form load called above in if statement
        Dim s As String = "<SCRIPT language='javascript'>document.getElementById('" & ctrl.ID & "').focus() </SCRIPT>"
        RegisterStartupScript("focus", s)
    End Sub

This script always works for me! Hope it helps!

What Do You Mean It Does Not Work
 
Old March 8th, 2006, 02:33 AM
Authorized User
 
Join Date: Mar 2006
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks RGB.. this really good code, it works for me too.. you are the best :)

thanks again






Similar Threads
Thread Thread Starter Forum Replies Last Post
Focus dhoward Javascript 3 September 19th, 2007 02:54 AM
Focus dhoward VB.NET 2002/2003 Basics 0 September 13th, 2007 02:23 PM
focus kvanchi General .NET 2 December 13th, 2004 09:16 PM
Focus jbenson001 ASP.NET 1.x and 2.0 Application Design 2 February 18th, 2004 02:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.