T
tshad
I have some textboxes that are being hidden using <div runat="server"> which
mean they are not on the page
But I am also trying to set focus to a Textbox when it is on the screen.
When the Textbox is not on the screen I am getting a JavaScript error:
document.forms.0.Email is null or not an object.
I tried to fix this by doing a test to see if it was not nothing. If it was
nothing, I would set the <body> tag to "". I tried this in the Page_Load as
well as Page_PreRender but this doesn't work either - like so:
Sub Page_PreRender(sender as Object, e as EventArgs)
if not Email is nothing then
myBody.Attributes.Add("onLoad","document.forms[0].Email.focus()")
else
myBody.Attributes.Add("onLoad","")
end if
End Sub
Is there a way to make this work?
Thanks,
Tom
mean they are not on the page
But I am also trying to set focus to a Textbox when it is on the screen.
When the Textbox is not on the screen I am getting a JavaScript error:
document.forms.0.Email is null or not an object.
I tried to fix this by doing a test to see if it was not nothing. If it was
nothing, I would set the <body> tag to "". I tried this in the Page_Load as
well as Page_PreRender but this doesn't work either - like so:
Sub Page_PreRender(sender as Object, e as EventArgs)
if not Email is nothing then
myBody.Attributes.Add("onLoad","document.forms[0].Email.focus()")
else
myBody.Attributes.Add("onLoad","")
end if
End Sub
Is there a way to make this work?
Thanks,
Tom