By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,870 Members | 1,236 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,870 IT Pros & Developers. It's quick & easy.

Converted HTML TextBox - .Text and .Value different properties?

P: n/a
Dear Group

Sorry for bothering you again but I need expert advice on this.
I have placed a HTML textbox on my aspx form and converted it to run
as a server control. At some point in my code I assign a value to this
textbox using Javascript with 'Form1.TextBox1.Value = "Hello"'

But when I want to read the value of this Textbox later on using VB
with 'MyVar = TextBox1.Text' it returns nothing.

Are .text and .value different properties?
How can I access the value, assigned to the texbox with Javascript,
with VB?

Thanks for your time & efforts!

Martin
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
> Sorry for bothering you again but I need expert advice on this.
I have placed a HTML textbox on my aspx form and converted it to run
as a server control. At some point in my code I assign a value to this
textbox using Javascript with 'Form1.TextBox1.Value = "Hello"'

Why not just place a Web Form Textbox (<ASP:Textbox>) on the page instead of
an HTML textbox (<INPUT TYPE="Text">)? Marking an HTML control as a server
control using runat=server is really just for upgrading existing (classic
ASP) controls to ASP.NET controls without having to replace the controls
entirely. If you are starting from scratch, just use the Web Form textbox.
But when I want to read the value of this Textbox later on using VB
with 'MyVar = TextBox1.Text' it returns nothing.
That's because you are not using a Web Form textbox (which has a .text
property), you are using an HTML textbox (which uses a .value property).
You'll need to retrieve the value from the .value property.
Are .text and .value different properties?
Yes. HTML textboxes don't have a .text property, Web Form textboxes do.
How can I access the value, assigned to the texbox with Javascript,
with VB?


Use the .value property.

But again, I would suggest just using a Web Form textbox from the start to
avoid all this confusion.
Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.