how to put focus on textbox?
Printable View
how to put focus on textbox?
You can write a javascript code in the code behind class
Here is an example This might be helpful, I have not tried it ..
Protected Sub SetFocus(ByVal ctrl As Control)
Dim strbuild As New System.Text.StringBuilder("")
With strbuild
.Append("<script language='JavaScript'>")
.Append("function SetFocus()")
.Append("{")
.Append("document.")
.Append(ctrl.Parent.ID)
.Append("['")
.Append(ctrl.UniqueID)
.Append("'].focus();")
.Append("}")
.Append("window.onload = SetFocus;")
.Append("")
.Append("</script")
.Append(">")
End With
ctrl.Page.RegisterClientScriptBlock("SetFocus", strbuild.ToString())
End Sub
Call SetFocus(textbox1) in the page load event