jitni
August 2nd, 2005, 03:38 AM
how to put focus on textbox?
|
Click to See Complete Forum and Search --> : textbox jitni August 2nd, 2005, 03:38 AM how to put focus on textbox? aquafin August 3rd, 2005, 11:48 PM 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 codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |