P
parm
How do I highlight text in my first (tabindex = 1) asp control (eg:
textbox) on the webform on page load. If I try to set focus using
javascript then I get script error "Cannot move focus to invisible
control)". Because the tabindex of first control is 1 therfore I can
get the focus on first control but the text inside is not highlighted.
Any help would be greatly appriciated.
My set focus javascript:
Public Sub SetFocus(ByRef MyPage As System.Web.UI.Page, _
ByVal objMyObject As Object)
Dim ctrLiteralControl As LiteralControl
On Error GoTo ErrorMsg
ctrLiteralControl = _
New LiteralControl("<script language=JavaScript>" &
_
"document.getElementById('" & objMyObject.ID &
"').focus();" & _
"document.getElementById('" & objMyObject.ID &
"').select();" & _
"</script>")
MyPage.Controls.Add(ctrLiteralControl)
End Sub
textbox) on the webform on page load. If I try to set focus using
javascript then I get script error "Cannot move focus to invisible
control)". Because the tabindex of first control is 1 therfore I can
get the focus on first control but the text inside is not highlighted.
Any help would be greatly appriciated.
My set focus javascript:
Public Sub SetFocus(ByRef MyPage As System.Web.UI.Page, _
ByVal objMyObject As Object)
Dim ctrLiteralControl As LiteralControl
On Error GoTo ErrorMsg
ctrLiteralControl = _
New LiteralControl("<script language=JavaScript>" &
_
"document.getElementById('" & objMyObject.ID &
"').focus();" & _
"document.getElementById('" & objMyObject.ID &
"').select();" & _
"</script>")
MyPage.Controls.Add(ctrLiteralControl)
End Sub