QUERY: JavaScript vs. ASP.NET Web/Server Controls

Discussion in 'ASP .Net' started by dhruba.bandopadhyay, Mar 31, 2006.

  1. Is it possible for JavaScript to access the DOM of ASP.NET Web/Server
    Controls?

    For example, I have a legacy HTML forms, controls, etc. If I conver
    all
    my HTML into Web Controls (by adding runat="server & id="") then will
    this affect my JavaScript code that accesses/modifies the DOM of th
    page
    (DOM tables, childs, elements, traversing, etc.) If so, what is th
    best
    way to make them compatible again


    -
    dhruba.bandopadhya
    -----------------------------------------------------------------------
    Posted via http://www.codecomments.co
    -----------------------------------------------------------------------
    dhruba.bandopadhyay, Mar 31, 2006
    #1
    1. Advertising

  2. On Fri, 31 Mar 2006 04:56:48 -0600, dhruba.bandopadhyay
    <> wrote:

    >
    > Is it possible for JavaScript to access the DOM of ASP.NET Web/Server
    > Controls?
    >
    > For example, I have a legacy HTML forms, controls, etc. If I convert
    > all
    > my HTML into Web Controls (by adding runat="server & id="") then will
    > this affect my JavaScript code that accesses/modifies the DOM of the
    > page
    > (DOM tables, childs, elements, traversing, etc.) If so, what is the
    > best
    > way to make them compatible again?
    >
    >
    >
    > --
    > dhruba.bandopadhyay
    > ------------------------------------------------------------------------
    > Posted via http://www.codecomments.com
    > ------------------------------------------------------------------------
    >


    Only thing is that the ids in the rendered code will change (at least I
    think so for HtmlControls, I know they do for WebControls). If a control
    is a 'container' control, the ids of the controls inside of it will get a
    prefix on its id (so all ids are unique).

    Anyway, just use the control's .ClientID instead of its .ID in the .NET
    code and it'll figure out the name for you at runtime. A good practice in
    general when building Javascript code in .NET.

    --
    Craig
    Microsoft MVP - ASP/ASP.NET
    Craig Deelsnyder, Mar 31, 2006
    #2
    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. =?Utf-8?B?c2lhag==?=
    Replies:
    7
    Views:
    1,451
    =?Utf-8?B?c2lhag==?=
    Mar 7, 2005
  2. Bob Rock
    Replies:
    1
    Views:
    611
    Cowboy \(Gregory A. Beamer\)
    Sep 17, 2006
  3. Nathan Sokalski
    Replies:
    5
    Views:
    982
    Gaurav Vaish \(www.Edujini-Labs.com\)
    Jan 10, 2007
  4. Eric Nelson
    Replies:
    5
    Views:
    1,503
    Alexey Smirnov
    Feb 4, 2009
  5. brian

    HTML Server Controls vs Web Server Controls

    brian, Jan 21, 2005, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    299
    Steve C. Orr [MVP, MCSD]
    Jan 24, 2005
Loading...

Share This Page