javascript getElementById

R

rodchar

hey all,

Label1 is a bound control inside a TableCell

var x = document.getElementById('Label1')

i want to suffix the Label1 control with another Label control inside the
same TableCell. Can someone please tell me the best way to do this?

thanks,
rodchar
 
G

Guest

hey all,

Label1 is a bound control inside a TableCell

var x = document.getElementById('Label1')

i want to suffix the Label1 control with another Label control inside the
same TableCell. Can someone please tell me the best way to do this?

thanks,
rodchar

You cannot use 'Label1', because .NET rendering engine automatically
generates another identification for a control. To get the client id
of the server control, use Control.ClientID Property.

e.g.

var x = document.getElementById('<%Label1.ClientID%>')

http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientid.aspx
 

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,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top