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. Advertisements

  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. Advertisements

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?Sg==?=

    Query Exchange Server for ASP.NET web app

    =?Utf-8?B?Sg==?=, Feb 27, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,782
    =?Utf-8?B?R2VvcmdlIER1cnpp?=
    Feb 28, 2004
  2. dx
    Replies:
    10
    Views:
    1,148
    John Saunders
    Apr 11, 2004
  3. =?Utf-8?B?c2lhag==?=
    Replies:
    7
    Views:
    1,841
    =?Utf-8?B?c2lhag==?=
    Mar 7, 2005
  4. Bob Rock
    Replies:
    1
    Views:
    910
    Cowboy \(Gregory A. Beamer\)
    Sep 17, 2006
  5. Nathan Sokalski
    Replies:
    5
    Views:
    1,303
    Gaurav Vaish \(www.Edujini-Labs.com\)
    Jan 10, 2007
  6. Nathan Sokalski
    Replies:
    4
    Views:
    553
    Nathan Sokalski
    Dec 21, 2006
  7. brian

    HTML Server Controls vs Web Server Controls

    brian, Jan 21, 2005, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    427
    Steve C. Orr [MVP, MCSD]
    Jan 24, 2005
  8. Nathan Sokalski
    Replies:
    4
    Views:
    588
    Nathan Sokalski
    Dec 21, 2006
Loading...