Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   javascript getElementById (http://www.velocityreviews.com/forums/t619285-javascript-getelementbyid.html)

rodchar 06-09-2008 02:32 PM

javascript getElementById
 
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

Alexey Smirnov 06-09-2008 08:07 PM

Re: javascript getElementById
 
On Jun 9, 4:32*pm, rodchar <rodc...@discussions.microsoft.com> wrote:
> 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/libr....clientid.aspx

rodchar 06-11-2008 03:16 PM

Re: javascript getElementById
 
thanks for the tip,
rod.

"Alexey Smirnov" wrote:

> On Jun 9, 4:32 pm, rodchar <rodc...@discussions.microsoft.com> wrote:
> > 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/libr....clientid.aspx
>



All times are GMT. The time now is 01:24 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.