Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: .focus() method for web_form controls


Message #1 by "Louis T. Klauder" <lklauder@w...> on Sat, 28 Jul 2001 02:02:09
Leena;

You are an angel. What you pointed out
solved my problem. Interestingly, I had
just gotten partly past the problem by
resorting to
	<INPUT id="server_name" type="text" runat="server" ...>
and in the script
	Page.server_name.focus()

that seems just a little less convenient than a web_form
text box control (namely, have to add by hand, runat="server"
in the html, and a declaration in the code behind). However,
the other control that I want to be able to give focus to
is a drop-down list, and switching that from a web_form
control to a server-side HTML would be a complete and total
pain. So, as a lame substitute I was going to move focus
to the text box that follows the drop-down in the tab
order. Your tip let me do what I originally wanted.

By the way, to what world does document.all... belong?
I am guessing that it is part of JavaScript or JScript
and that the functionality is provided by IE 5.x. I
searched in the MSDN library and in the indices of a
couple of books on ASP.NET till I was blue in the face
without finding what you pointed out. Where did you
find it?

Thanks again,

Lou

-----Original Message-----
From: Leena Natekar [mailto:paradise_flycatcher@y...]
Sent: Saturday, July 28, 2001 9:28 AM
To: ASPX_Professional
Subject: [aspx_professional] Re: .focus() method for web_form controls


Hi,

You can still use have a onload javascript function
and set focus to the required control....
this is the way i do it..
document.all["txtUsrName"].focus("true");
txtUsrName --> my asp.net textbox control.

Regards,
Leena
--- "Louis T. Klauder" <lklauder@w...> wrote:
> I am migrating an Access 2000 application to a
> browser counterpart using
> ASP.NET. I am hung up because the DHTML .focus()
> method that works nicely
> for HTML controls does not seem to be available for
> web_form controls
> in .NET beta 2. Is there a work-around other than
> reverting to HTML for
> controls that need focus when pages are loaded?



  Return to Index