I have a situation where I am Registering a Startup script with the
following code:
If Not IsPostBack Then
Dim sScript As StringBuilder = New StringBuilder
sScript.Append("<SCRIPT language=""javascript"">" & vbCrLf)
sScript.Append("document.all.Contact_txtLoginUserN ame.focus()")
sScript.Append("</SCRIPT>" & vbCrLf)
Page.RegisterStartupScript("Window.OnLoad", sScript.ToString)
End if
The problem is that I am using two panels...one which contains the textbox
that I am adding focus to, but one the user logs in I am setting the
visibility of the panel that contains the txtLoginUserName = false, so now
on postback the page errors out because the control is not there. Is there
a way to unregister the script if isPostBack = true?
I already have the registerStartUpScript in the if Not IsPostBack check.
Thanks,
Ron