473,320 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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
1 6675
> 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Alpha | last post by:
Hi, I have a window based program. One of the form has several textboxes and a datagrid. The textboxes are bind to the same dataset table as the datagrid and the text changes to reflect different...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
1
by: Paul M. Frazier, Ph.D. | last post by:
I am writing a user information update page and I populate the form on Page_Load with the current values of the user's name, etc. When I change the text in one of the textbox controls (e.g.,...
5
by: JollyK | last post by:
Hello all, I have always been having this issue and wondering what the solution is. When I set the enableviewstate property to false for a textbox, the textbox always retains its value after a...
5
by: hans.bonefaas | last post by:
Hi all, I hope someone can help me with the following problem in ASP.net. I want to edit the information for a record in a database (MS Access). On the page I placed several textboxes and...
0
by: jason | last post by:
Hello everyone. I am trying to write some custom command events into a DataGrid. The command that is currently giving me trouble is an "Add" custom command in the footer of a template column. ...
2
by: jason | last post by:
hello. i am just trying to save a TextBox.Text value to a database, but strangely, when the value is changed on the web form, the changes are not recognized in the event where i try to save the...
1
by: daleykd | last post by:
Hello all. I've been pulled out my hair all day trying to figure this one out. In VB .NET 2.0, I'm attempting to create a custom control inheriting a TextBox. I've attempted to do a: ...
5
by: =?Utf-8?B?ZWdzZGFy?= | last post by:
I had to create a HTML textbox to add the date time but I don't know how to assign the value with asp.net, how can I do that? This is my HTM Textbox code: <input id="txtFechaPlan"...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.