I have a ASP.Net button that does some code when it's clicked, but I would also like it to open a new window with another page in it. How can I have that fire from ASP?
If you'd like a handy way to set the focus of a control without having to write code over and over again, use this handy little function:
Private Sub SetFocus(ByVal ctrl As System.Web.UI.Control)
Dim s As String =
"<SCRIPT language='javascript'>document.getElementById('"
& ctrl.ID & "').focus() </SCRIPT>"
RegisterStartupScript("focus", s)
End Sub
So when calling it, you just need to pass a reference to the control.
i.e.
SetFocus(TextBox1)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.