G
Guest
Hi,
I have a setfocus that works fine:
Private Sub SetFocus(ByVal ctrl As Control)
Dim focusScript As String = "<script language='javascript'>" & _
"document.getElementById('" + ctrl.ClientID & _
"').focus();</script>"
Page.RegisterStartupScript("FocusScript", focusScript)
End Sub
Is there a way I can put this in a modue and send in the Page name as a constraint so that I can just declare the function once instead of all over the place? I have tried something (but not exactly) like this...
Private Sub SetFocus(ByVal ctrl As Control, Byref pPage As Page)
Dim focusScript As String = "<script language='javascript'>" & _
"document.getElementById('" + ctrl.ClientID & _
"').focus();</script>"
pPage.RegisterStartupScript("FocusScript", focusScript)
End Sub
but Im missing something.
I have a setfocus that works fine:
Private Sub SetFocus(ByVal ctrl As Control)
Dim focusScript As String = "<script language='javascript'>" & _
"document.getElementById('" + ctrl.ClientID & _
"').focus();</script>"
Page.RegisterStartupScript("FocusScript", focusScript)
End Sub
Is there a way I can put this in a modue and send in the Page name as a constraint so that I can just declare the function once instead of all over the place? I have tried something (but not exactly) like this...
Private Sub SetFocus(ByVal ctrl As Control, Byref pPage As Page)
Dim focusScript As String = "<script language='javascript'>" & _
"document.getElementById('" + ctrl.ClientID & _
"').focus();</script>"
pPage.RegisterStartupScript("FocusScript", focusScript)
End Sub
but Im missing something.