Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET 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 January 5th, 2005, 02:02 PM
Authorized User
 
Join Date: Jan 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Focussing on a specific text box

The Problem:
1. I use SmartNavigation= True in asp.net (.aspx file). It helps to reduce flickers in round trips to the server.

2. However, the focus is again set back to the same textbox which has autopostback=true property. It is quite irritating.

3. What shall I do to focus it on next field(textbox) after autopostback has taken place.

e.g. Empno: -----
     Name : ------------------------------

Empno has autopostback=true. So when a user types 127, it goes to server where my codebehind(vb.net), accesses Employee database and
fills all the details of this employee such as Employee Name and the posts back this filled form to the browser.

I obviously, want to Now Focus on Name and not back onto Empno.

How to Do this?



 
Old January 5th, 2005, 03:31 PM
Authorized User
 
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey Dilip Nagle,

After the form is filled, in your code-behind call this:

      Page.RegisterStartupScript("GoToNameFocus", "<script language='javascript'> { document.all ['" & NameOfYourContrl & "'].focus(); }</script>")

Let me know how it goes !
 
Old January 5th, 2005, 11:26 PM
Authorized User
 
Join Date: Jan 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It simply worked wondefully.
In fact, I am now using it extensively to focus on any desired textbox at any point of time.
I used
<script language='javascript'>
{document.all.txtEmpName.focus();}
</script>")

Many Thanks,

Dilip Nagle

 
Old January 6th, 2005, 12:39 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

I have always felt that though "Smartnavigation" is a nice concept ... we should avoid using it!! You can google to find out the disadvantages of using it.

Just a sample: http://weblogs.asp.net/ksamaschke/ar...4/27/6085.aspx

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com
 
Old January 6th, 2005, 02:16 PM
Authorized User
 
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Glad I could help.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Count in combo box(display results in text box) mboyisis Access 4 April 4th, 2008 07:08 AM
How to fetch text after specific tag text dipsut XSLT 10 May 23rd, 2007 02:57 PM
getnodes after specific text pendyalap XSLT 1 June 8th, 2006 05:13 PM
Set cursor at specific location in text box pritz VB How-To 3 August 29th, 2005 10:27 AM
Set cursor at specific location in text box pritz Beginning VB 6 1 August 15th, 2005 12:22 PM





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