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

  • Thread starter dhruba.bandopadhyay
  • Start date
D

dhruba.bandopadhyay

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
 
C

Craig Deelsnyder

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?

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top