Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ASPX, ASCX and JavaScript Interrelationships

Posted on 2013-05-25
3
Medium Priority
?
424 Views
Last Modified: 2013-06-04
Greetings;

I have 3 sets of entities as follows:

1. Two dozen ASPX pages which incorporate a common header
2. A stored JavaScript source which references controls in a #include in the ASPX pages
3. A #include containing HTML defining the header presentation.

Using Visual Studio 2010 Pro, #include statements are not processed in order for me to see the entire marked up page when in design mode for an ASPX page.

If I try and place the #include HTML in an ASCX user control, the JavaScript returns an error indicating the control I'm attempting to access (which is defined in the ASCX user control) in the JavaScript does not exist.

I also attempted to include the JavaScript with the ASCX page which also resulted in JavaScript errors.

I attempted to create a Master page, however, the JavaScript gave me a similar error after creating a new ASPX page using the Master page. The Master page included the common elements of each page including the #include HTML and the JavaScript.

Is there a way using an ASCX user control to have the #include HTML and subsequently have the JavaScript (referenced in each ASPX page) reference controls within the ASCX file?


Much thanks ... David
0
Comment
Question by:David Bach
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 18

Expert Comment

by:Gary Davis
ID: 39197716
You did not include any code to review or specific error messages to help resolve this question. However, #include seems to be from the old .asp (pre-dotNet) days. Including HTML would be done by using ascx user controls which could emit HTML in various ways (inline HTML, reading a template or "include" file, etc).

As far as having JavaScript interact with controls within the ascx user control, it would actually be working with the Html controls, DOM, or perhaps jQuery objects on the client side and not the server controls.

Gary Davis
0
 

Accepted Solution

by:
David Bach earned 0 total points
ID: 39208685
Greetings;

My apologies for not responding sooner. I found a solution and proved it to work by putting it into practice.

Using Master Pages I am able to encapsulate the JavaScript I have into an external .js file, and, place the boiler plate HTML and code behind code into the Master Page. This resolves the redundancy of having this same code in every page. I needed to research how to register JavaScript code via VB in order to ensure the generated ID names were used in the JavaScript function.

Thank you ... David
0
 

Author Closing Comment

by:David Bach
ID: 39218404
Greetings;

I did not initially provide enough data for the question to be resolved. This was an assumption on my part and not intentional.

Between the time I posted the question and now, I found an acceptable solution.


Thank you ... David
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question