javascript getElementById

Discussion in 'ASP .Net' started by rodchar, Jun 9, 2008.

  1. rodchar

    rodchar 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
    rodchar, Jun 9, 2008
    #1
    1. Advertising

  2. On Jun 9, 4:32 pm, rodchar <> 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/library/system.web.ui.control.clientid.aspx
    Alexey Smirnov, Jun 9, 2008
    #2
    1. Advertising

  3. rodchar

    rodchar Guest

    thanks for the tip,
    rod.

    "Alexey Smirnov" wrote:

    > On Jun 9, 4:32 pm, rodchar <> 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/library/system.web.ui.control.clientid.aspx
    >
    rodchar, Jun 11, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nathan Sokalski

    JavaScript, Windows Mobile, and document.getElementById()

    Nathan Sokalski, May 26, 2009, in forum: ASP .Net Mobile
    Replies:
    4
    Views:
    1,466
  2. lawrence
    Replies:
    1
    Views:
    175
    Vincent van Beveren
    Jun 11, 2004
  3. Katie
    Replies:
    2
    Views:
    183
    Randy Webb
    Jul 20, 2006
  4. SM
    Replies:
    6
    Views:
    101
    Gregor Kofler
    Jun 1, 2008
  5. adiraju_anuradha
    Replies:
    0
    Views:
    338
    adiraju_anuradha
    Nov 8, 2012
Loading...

Share This Page