Solved

Embedded resource not being picked up

Posted on 2006-07-21
7
390 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why is some text in blue in Visual Studio? 6 33
Entity Framework 7 43
performance issue in asp web 5 34
Example works but why do I need to click twice on button 4 43
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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

825 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