ARTICLE

How to set Focus on Web Server Controls in ASP.NET

Posted by Yogesh Verma Articles | VB.NET How do I April 16, 2007
This article shows you, how we can set the focus of any Web Server Control in ASP.NET.
 
Reader Level:

We can set the focus on a specific Web Server Control by using server code. For that we can call the control's Focus method on the Page_Load or in any Page Event, as per the requirement.

 

In the following example, we set the focus of the TextBox on the Page_Load.

 

Protected Sub Page_Load(ByVal sender As Object, _

    ByVal e As System.EventArgs)

    textBox.Focus()

End Sub

Login to add your contents and source code to this article
share this article :
post comment
 
Nevron Diagram
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor