Solved

Embedded resource not being picked up

Posted on 2006-07-21
7
387 Views
Last Modified: 2008-03-17
Hi

I am using asp.net 2.0 and I have a server control that contains a javascript file as an embedded resource. I don't really know much about embedded resources - I got this example off the internet.

In the dll for the server control there is a javascript file. This has a build action of embedded resource.

When i use the server control in a web application the js file is not being found and i get a javascript error. When i include the javascript in the page directly, everything is ok.

I know i need to add some code like this:
//syntax: [assembly: WebResource("{namespace}.{filename}", "{content-type}")]
[assembly: WebResource("AJE.Web2.Controls.UI.AutoComplete.js", "text/javascript")]


but i don't know where to put it. I tried putting it in the AssemblyInfo.cs file in the project of the server contol but that has not fixed the problem.

How do i get the web application using the server control to find the embedded resource.

Thanks very much for any help you can give.
andrea
0
Comment
Question by:andieje
  • 4
  • 2
7 Comments
 
LVL 5

Expert Comment

by:TheMehrdad
ID: 17159105
Hi, You have to tell me more about the problem to solve it.
Do you use the component as a referenced dll or add the source code of the component to your project?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17160849
Have you seen this article?  And, if you did, did you follow the instructions?

WebResource ASP.NET 2.0 explained
http://www.codeproject.com/aspnet/MyWebResourceProj.asp

Bob
0
 

Author Comment

by:andieje
ID: 17170319
Hi

I used the component as a referenced dll

Thanks andrea

Bob, I've seen similar articles and followed the instructions with no luck :(
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 5

Accepted Solution

by:
TheMehrdad earned 500 total points
ID: 17173594
Hi andrea,
Let's try this one:
1- Put the code [assembly: WebResource("AJE.Web2.Controls.UI.AutoComplete.js", "text/javascript")] in the AssemblyInfo.cs
2- Add this tag in your page Head tag
    <script language="javascript" type="text/javascript"
         src='<%# this.ClientScript.GetWebResourceUrl(typeof([YOUR COMPONENT TYPE]),"YOUR SCRIPT FULL NAME") %>'>
    </script>

Please be so carefull about the Type of your component and full name of the script.
Good luck
0
 

Author Comment

by:andieje
ID: 17191352
didn't see your reply - trying that today

thanks a lot
0
 

Author Comment

by:andieje
ID: 17205058
Hi

I tried that with no success :(

I am using vb.net and this is what i added:

    <script language="javascript" type="text/javascript"
         src='<%# Me.ClientScript.GetWebResourceUrl(GetType(AJE.Web2.Controls.UI.AutoCompleteDropDownList),"AutoComplete.js") %>'>
    </script>

and i tried
    <script language="javascript" type="text/javascript"
         src='<%# Me.ClientScript.GetWebResourceUrl(GetType(AJE.Web2.Controls.UI.AutoCompleteDropDownList),"AJE.Web2.Controls.UI.AutoComplete.js") %>'>
    </script>


both gave src=''

:(
0
 

Author Comment

by:andieje
ID: 17205125
also tried

I am using vb.net and this is what i added:

    <script language="javascript" type="text/javascript"
         src='<%# Me.ClientScript.GetWebResourceUrl(GetType(AJE.Web2.Controls.UI),"AutoComplete.js") %>'>
    </script>

and i tried
    <script language="javascript" type="text/javascript"
         src='<%# Me.ClientScript.GetWebResourceUrl(GetType(AJE.Web2.Controls.UIAJE.Web2.Controls.UI.AutoComplete.js") %>'>
    </script>


both gave src=''

:(
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now