?
Solved

Embedded resource not being picked up

Posted on 2006-07-21
7
Medium Priority
?
393 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 5

Accepted Solution

by:
TheMehrdad earned 2000 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

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…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

777 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