Using SetFocus on a Web Page (VB.NET)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to setfocus on a textbox after an error conditions, but the
compile insists that 'textbox.setfocus' isn't a valid command. I'm using all
the web page default setting, but am creating it in a FrontPage environment.
Does anyone know what I can do to make this command work?
 
CoTConnie said:
I'm trying to setfocus on a textbox after an error conditions, but the
compile insists that 'textbox.setfocus' isn't a valid command. I'm using all
the web page default setting, but am creating it in a FrontPage environment.
Does anyone know what I can do to make this command work?

Are you using a javascript that you set at runtime using
RegisterClientScriptBlock?
 
Yes, this is the only way that I'm aware of.

I have a special class called PageUtil and it encapsulates the method so
that I can set focus to a control when an error arises.
 
John,

Are you sure registerclientstript is working in this case?

I have to use it forever as javascript after the latest control in the html
because that latest get the focus after while the javascript in the
registerclientscript is than already done (however I ask this because I am
not completely sure because your definitive answer to this problem).

\\\
INPUT tabindex="1" id="fieldid" type="text" size="27">
//This beneath should than be the last rows in the html aspx file
<script language="JavaScript">
document.all("fieldid").focus();
</script>
</HTML>
///

Although I think that this is not the right solution for the OP, I assume
that it is better to use client side checking for this as long that there is
no database action required.

I thought that client side checking was described on this website.

http://samples.gotdotnet.com/quickstart/

While it is a typical problem often done in the newsgroup

microsoft.public.dotnet.framework.aspnet

I hope this helps a little bit?

Cor
 
Back
Top