473,395 Members | 1,530 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,395 software developers and data experts.

Setting values for a textbox in client javascript

I need to set the value of a asp text box in javascript.

<asp:TextBox id="txtUserValue" runat="server"
test</asp:TextBox>


I have tied:

function setValue(valueData) {
alert(valueData);

document.Analysis_UserEnt.txtUserValue.Value = valueData;

document.Analysis_UserEnt.txtUserValue.Text = valueData;

document.Analysis_UserEnt.txtUserValue.InnerText =
valueData;

None of these work. Any suggestions? The function
setValue is being called by a child page. This works as I
have used alert statements to track progress.

Analysis_UserEnt is the asp form id

Bob Storrs

Nov 18 '05 #1
1 2114
javascript is case sensitive you need to get it right

you options are:

document.Analysis_UserEnt.txtUserValue.value = valueData;
document.forms['Analysis_UserEnt'].txtUserValue.value = valueData;
document.getElementById('txtUserValue').value = valueData;

there is no .Text or .text property for an input box.

as the value of a text box is an attribute,

document.getElementById('txtUserValue').innerText
document.getElementById('txtUserValue').innerHTML

will return "", no matter what the value is.
-- bruce (sqlwork.com)

"Robert Storrs" <ro***********@intellinex.com> wrote in message
news:0c****************************@phx.gbl...
I need to set the value of a asp text box in javascript.

<asp:TextBox id="txtUserValue" runat="server"
test</asp:TextBox>


I have tied:

function setValue(valueData) {
alert(valueData);

document.Analysis_UserEnt.txtUserValue.Value = valueData;

document.Analysis_UserEnt.txtUserValue.Text = valueData;

document.Analysis_UserEnt.txtUserValue.InnerText =
valueData;

None of these work. Any suggestions? The function
setValue is being called by a child page. This works as I
have used alert statements to track progress.

Analysis_UserEnt is the asp form id

Bob Storrs

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Janaka | last post by:
Help! I have two ListBox controls on my web form. The first one gets populated on entry with values from the DB. I then use JavaScript to copy options from this ListBox to my second one. (I...
3
by: Ali | last post by:
I have 3 html input tex in my asp.net form. Two of them are calling javascript client side to calculate the differnce of two dates and put the result into the third input text. i haven't include...
3
by: Aaron | last post by:
I am having a little difficulty with a relatively simple task. I have a parent webform. I have a javascript attribute added to a button to open a new window when clicked. The user fills in a...
2
by: Pipo | last post by:
Nobody knows how to get the values provided in the client can be read in the user-control? If have made a Web Custom Control with 2 textboxes and 1 dropdownlist. The user fills in my control (the...
1
by: Andre Ranieri | last post by:
Hello, I'm trying to set up an ASP.NET 2.0 form where the user enters values in WebControls.TextBoxes for amount owing, interest and late fees and a JavaScript function totals the three values...
5
by: sklett | last post by:
I'm not real experienced with asp.net so this may be obvious. I've got a situation where some of my client side javascript is causing my posted form's controls to lose their values. In other...
2
by: VMI | last post by:
In the Page_Load() of my webForm, I have the following code, and on my HTML button, the onclick button calls writeVal() (the javascript function). When I click on the button, I see the messagebox...
5
by: Stuart Shay | last post by:
Hello All I am working on ASP.NET 1.1 Custom Pager that allows a User to Enter a Number in a TextBox and go to the page selected. Since the OnClick Event does not work in ASP.NET 1.1 for a...
1
by: anilkumar1980 | last post by:
Hi All, Here I need help to all of u, I am using ASP.NET 2.0 and Third party Infragistic Controls. I Have included master page in my page (<%@ Page Language="VB"...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.