Multiple ASP.Net Controls On One Page

Posted by Duracell on Stack Overflow See other posts from Stack Overflow or by Duracell
Published on 2010-05-27T23:22:00Z Indexed on 2010/05/27 23:31 UTC
Read the original article Hit count: 254

Filed under:
|
|

We have created a User Control for ASP.Net. At any one time, a user's profile page could contain between one and infinity of these controls. The Control.ascx file contains quite a bit of javascript. When the control is rendered by .Net to HTML, you notice that it prints the javascript for each control.

This was expected. I'd like to reduce the amount of HTML output by the server to increase page load times. Normally, you could just move the javascript to an external file and then you only need one extra HTTP request which will serve for all controls.

But what about instances in the javascript where we have something like

document.getElementById('<%= txtTextBox.ClientID %>');
How would the javascript know which user control work with? Has anyone done something like this, or is the solution staring me in the face?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about JavaScript