473,387 Members | 1,687 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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


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
1 1028
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
5
by: Krishna | last post by:
Hi all, Can i call my javascript functions from the web controls.Any appropriate site which will be tell more on this will be helpfull. Regards.., Krishna
0
by: Caesar Augustus | last post by:
I'm having a problem with two different javascript controls in my app. The first chuck of javascript that I pasted into my app is the client-side calendar control popup which works fine when first...
5
by: Dennis Fazekas | last post by:
Greetings, I am creating a web form which will all the user to add an unlimited number of email addresses. Basically I have 3 buttons, "Add Another Email", "-" to remove, and a "Save" button....
9
by: Boris Yeltsin | last post by:
I use Master Pages, so I make use of URL rebasing through the ~ operator, like this in the <head>: <link runat="server" href="~/Root.master.css" media="screen" rel="stylesheet" type="text/css" />...
4
by: Erland | last post by:
Hello everyone, I am have couple of bad concepts and would like to clear things up. As I understand ASP.NET server controls contain runat=server tag and they only run on the server. But I've...
8
by: Frank | last post by:
Hi, I am working with VS.NET 2005 Ultimately, I wish to call a JavaScript function from a .js file
4
by: archana | last post by:
Hi all, i am having one user control. what i want is to add javascript which will gets called on button click of user control. but user control is not working if i add javascript in user...
4
by: Lewis Holmes | last post by:
Hi I have the following situation in one of my asp.net pages. The user can add multiple table rows to a form by selecting a button. These rows can contain asp.net controls. When this button is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.