P
paul
Hi, I'm trying to use Page_Load to set focus to a
textbox1 and I get the following error:
"Object Doesn't Support This Property or Method".
Here is my VB code behind:
Dim scriptString As New System.Text.StringBuilder()
scriptString.Append("<script Language='javascript'>")
scriptString.Append("document.getElementByID
('TextBox1').focus();")
scriptString.Append("</script>")
Me.RegisterStartupScript("setFocus",scriptString.ToString)
I tested a few things:
1. Rename 'TextBox1' to 'ABC' (garbage string) and I get
the same error. This tells me that I may actually have a
code behind syntax error, but it isn't reported as such.
2. I tried other variations where I used ampersand and Chr
(34) to encapsulate 'TextBox1', and it did not recognize
the ampersand (or the + sign) as characters that it could
use with a string. (?? This is very different than VB6
Windows apps.)
Any ideas what I might try besides running a script right
out of the ASP.NET? That does work, but I would like to
learn more about why this code behind is failing. Thanks,
Paul
textbox1 and I get the following error:
"Object Doesn't Support This Property or Method".
Here is my VB code behind:
Dim scriptString As New System.Text.StringBuilder()
scriptString.Append("<script Language='javascript'>")
scriptString.Append("document.getElementByID
('TextBox1').focus();")
scriptString.Append("</script>")
Me.RegisterStartupScript("setFocus",scriptString.ToString)
I tested a few things:
1. Rename 'TextBox1' to 'ABC' (garbage string) and I get
the same error. This tells me that I may actually have a
code behind syntax error, but it isn't reported as such.
2. I tried other variations where I used ampersand and Chr
(34) to encapsulate 'TextBox1', and it did not recognize
the ampersand (or the + sign) as characters that it could
use with a string. (?? This is very different than VB6
Windows apps.)
Any ideas what I might try besides running a script right
out of the ASP.NET? That does work, but I would like to
learn more about why this code behind is failing. Thanks,
Paul