Passing a value from server side to client side

K

kimberly.walker

Im having a bit of a problem here, what I want to do is a user types
in data in a text box then I need to pass that data to the client side.
The problem Im having is I can't seem to get the value from the text
box be it a regular asp.net text box or even when I assign a value in a
hidden textbox I still can't seem to get the value. I thought using:
document.getElementbyID("Client_ID").innerText would get the value but
its not.
Any help will be greatly appreciated.
Thanks
 
S

S. Justin Gengo

Kimberly,

The first thing to check is whether or not you have the correct client id.
ViewSource on the page and double check what client id your control is being
rendered with.

Regards,

--
S. Justin Gengo
Web Developer / Programmer

Free code library:
http://www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
E

Eliyahu Goldin

Where is the textbox? Grid/DataList/Repeater? User control? Content page?

Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
 
K

kimberly.walker

Hi Eliyahu,
The text box is an asp.net text on a user control

Eliyahu said:
Where is the textbox? Grid/DataList/Repeater? User control? Content page?

Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

Im having a bit of a problem here, what I want to do is a user types
in data in a text box then I need to pass that data to the client side.
The problem Im having is I can't seem to get the value from the text
box be it a regular asp.net text box or even when I assign a value in a
hidden textbox I still can't seem to get the value. I thought using:
document.getElementbyID("Client_ID").innerText would get the value but
its not.
Any help will be greatly appreciated.
Thanks
 
E

Eliyahu Goldin

You should use the textbox ClientID property. You need to pass it from
server to client. If you do it in a hidden input control, it may look like:

<input type="hidden" id="clientId" runat="server"/>
....
var clientId=document.getElementById("clientId").value;
....
myText=document.getElementById(clientId).value

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

Hi Eliyahu,
The text box is an asp.net text on a user control

Eliyahu said:
Where is the textbox? Grid/DataList/Repeater? User control? Content page?

Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

Im having a bit of a problem here, what I want to do is a user types
in data in a text box then I need to pass that data to the client side.
The problem Im having is I can't seem to get the value from the text
box be it a regular asp.net text box or even when I assign a value in a
hidden textbox I still can't seem to get the value. I thought using:
document.getElementbyID("Client_ID").innerText would get the value but
its not.
Any help will be greatly appreciated.
Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top