Solved

Embedded resource not being picked up

Posted on 2006-07-21
7
389 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

863 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

22 Experts available now in Live!

Get 1:1 Help Now