R
RSH
I have a situation where I am successfully adding an Onload to the Body tag
from the codebehind from a page using the following code:
Protected WithEvents body1 As System.Web.UI.HtmlControls.HtmlGenericControl
If Not IsPostBack Then
body1.Attributes.Add("OnLoad",
"preloadImages();javascript:document.all.UserLogin_txtUserName.focus()")
Else
body1.Attributes.Remove("OnLoad")
body1.Attributes.Add("OnLoad", "preloadImages();")
End If
Now I am creating a user control that needs to be able to do the same thing.
I added the code to the control but I get a null exception error when I add
the control to the page. Is there a way to do this?
Thanks!
Ron
from the codebehind from a page using the following code:
Protected WithEvents body1 As System.Web.UI.HtmlControls.HtmlGenericControl
If Not IsPostBack Then
body1.Attributes.Add("OnLoad",
"preloadImages();javascript:document.all.UserLogin_txtUserName.focus()")
Else
body1.Attributes.Remove("OnLoad")
body1.Attributes.Add("OnLoad", "preloadImages();")
End If
Now I am creating a user control that needs to be able to do the same thing.
I added the code to the control but I get a null exception error when I add
the control to the page. Is there a way to do this?
Thanks!
Ron