What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 10130 |  Welcome, Guest!   Register  Login
 Home > Code Snippets > ASP.NET > Set Focus of Controls in ASP.NET ...
Santosh4u

Set Focus of Controls in ASP.NET

 Code Snippet posted by: Santosh4u | Posted on: 10/24/2009 | Category: ASP.NET Codes | Views: 1375 | Status: [Member] | Alert Moderator   


Refer Below Code to Set the Focus of a Control in asp.net
you need to call this method where you want to set focus of control.
  Private Sub SetFocus(ByVal FocusControl As Control)

Dim Script As New System.Text.StringBuilder
Dim ClientID As String = FocusControl.ClientID
With Script
.Append("<script language='javascript'>")
.Append("document.getElementById('")
.Append(ClientID)
.Append("').focus();")
.Append("</script>")
End With
RegisterStartupScript("setFocus", Script.ToString())
End Sub

Regards
Santosh
Found interesting? Add this to:


>> Write Response - Respond to this post and get points

More codes snippets

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/25/2013 2:39:37 AM