Solved

Embedded resource not being picked up

Posted on 2006-07-21
7
391 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
[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
  • 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

730 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