Friday, March 16, 2012

Passing a value from server side to client side

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.
ThanksWhere is the textbox? Grid/DataList/Repeater? User control? Content page?

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

<kimberly.walker@.consultant.comwrote in message
news:1152715225.255729.148180@.b28g2000cwb.googlegr oups.com...

Quote:

Originally Posted by

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
>


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

<kimberly.walker@.consultant.comwrote in message
news:1152715225.255729.148180@.b28g2000cwb.googlegr oups.com...

Quote:

Originally Posted by

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
>


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

Eliyahu Goldin wrote:

Quote:

Originally Posted by

Where is the textbox? Grid/DataList/Repeater? User control? Content page?
>
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
>
<kimberly.walker@.consultant.comwrote in message
news:1152715225.255729.148180@.b28g2000cwb.googlegr oups.com...

Quote:

Originally Posted by

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


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]

<kimberly.walker@.consultant.comwrote in message
news:1152759520.814547.273090@.m79g2000cwm.googlegr oups.com...

Quote:

Originally Posted by

Hi Eliyahu,
The text box is an asp.net text on a user control
>
Eliyahu Goldin wrote:

Quote:

Originally Posted by

>Where is the textbox? Grid/DataList/Repeater? User control? Content page?
>>
>Eliyahu Goldin,
>Software Developer & Consultant
>Microsoft MVP [ASP.NET]
>>
><kimberly.walker@.consultant.comwrote in message
>news:1152715225.255729.148180@.b28g2000cwb.googlegr oups.com...

Quote:

Originally Posted by

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
>


>

0 comments:

Post a Comment