Saturday, March 24, 2012

Set focus on page load

Hello,

This is probably super simple but I can't figure out how to set the initial focus on an aspx page. I have a text box control that I would like to be the default focus on page load, how do I do this?

Thanks for any help

-SI think this might be the simple way but only good for IE:


<asp:TextBox id=TextBox1 runat="server"></asp:TextBox>
<SCRIPT>window.document.all["TextBox1"].focus()</SCRIPT>

Please see below thread, it has related info on it

http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=314815

0 comments:

Post a Comment