how to set the focus to a control by default?
<p>i have a login control and a create user control i my web page...i want the cursor to be in the user name text box of the login control when the page loads...how can i do that??</p>

<pre><code>&lt;asp:LoginView ID="LoginView1" runat="server"&gt;
              &lt;LoggedInTemplate&gt;
                  Bingo..!!! Youuuuu did it...&lt;asp:LoginName ID="LoginName1" runat="server" /&gt;.



              &lt;/LoggedInTemplate&gt;
              &lt;AnonymousTemplate&gt;

                  &lt;asp:DropShadowExtender ID="DropShadowExtender1" runat="server" 
                                            TargetControlID="Panel1" 
                                            Rounded="true" 
                                            Opacity=".38"&gt;
                  &lt;/asp:DropShadowExtender&gt;
                  &lt;asp:Panel ID="Panel1" runat="server" 
                                         BackColor="Silver"&gt;
                  &lt;asp:Login ID="Login1" runat="server" 
                                         DestinationPageUrl="~/ViewCart_aspx/ViewCart.aspx" 
                                         Height="152px" 
                                         Width="396px" 
                                         RememberMeSet="True" 
                                         OnLoggedIn="ContinueButton_Click" &gt;
                      &lt;LayoutTemplate&gt;
                          &lt;fieldset&gt;
                          &lt;table border="0" 
                                 cellpadding="1" 
                                 cellspacing="0" 
                                 style="border-collapse:collapse;"&gt;
                              &lt;tr&gt;
                                  &lt;td&gt;
                                      &lt;table border="0" cellpadding="0" style="height:152px;width:396px;"&gt;
                                          &lt;tr&gt;
                                              &lt;td align="center" colspan="2"&gt;
                                                 &lt;h3&gt;Log In&lt;/h3&gt; &lt;/td&gt;
                                          &lt;/tr&gt;
                                          &lt;tr&gt;
                                              &lt;td align="right"&gt;
                                                  &lt;asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName"&gt;User Name:&lt;/asp:Label&gt;
                                              &lt;/td&gt;
                                              &lt;td&gt;&amp;nbsp;
                                                  &lt;asp:TextBox ID="UserName" runat="server" Width="150px" TabIndex="0"&gt;&lt;/asp:TextBox&gt;
                                                  &lt;asp:RequiredFieldValidator ID="UserNameRequired" runat="server" 
                                                      ControlToValidate="UserName" ErrorMessage="User Name is required." 
                                                      ToolTip="User Name is required." ValidationGroup="ctl01$Login1"&gt;*&lt;/asp:RequiredFieldValidator&gt;
                                              &lt;/td&gt;
                                          &lt;/tr&gt;
</code></pre>

<p>as u can see the <code>UserName</code> textbox is inside the login control..so i cannot access its property..how do i find the control??</p>
