By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,353 Members | 1,529 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,353 IT Pros & Developers. It's quick & easy.

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

P: n/a

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

Mar 31 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Fri, 31 Mar 2006 04:56:48 -0600, dhruba.bandopadhyay
<dh************************@mail.codecomments.co m> 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
Mar 31 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.