javascript getElementById

  • Thread starter Thread starter rodchar
  • Start date Start date
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
 
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
 
Back
Top