views:

27

answers:

2

Hi all,

I'm developing a website using SiteFinity in Visual Studio 2008. This is a web site project rather than a web application project.

During development I am finding myself developing lots and lots of user controls. The problem with this is that each user control needs to use some javascript and css. Now i can either include the css/js for every single control in a couple of global css/js files, or I have started reading today about Web Resources.

Strangely, I cant seem to find any information that shows me, how to achieve this, and whether it has to be a compiled file rather than just creating resources which can be accessed from my user controls.

Can anyone provide a brief overview, or point me in the right direction to one?

Thanks in advance higgsy

A: 

Here's how to add script resources to a page. The resource should be in a compiled assembly, its build action should be set to "Embedded Resource" (through right click -> properties), and it should be registered as a web resource in the assembly's AssemblyInfo.cs file.

If we assume you only need to do this for client-side code and not other types of web resources, and if you are developing script controls (with their client side compontents), this could be directly done in the implementation of GetScriptReferences method.

Slavo
A: 

You can't create embedded resources in a Web Site Project.

You can create embedded resources in a Web Application Project.

alt text

This Build Action property will be missing in a Web Site Project. If you're using a Web Site Project, you can create a new Class project (new assembly), which will enable you to use Embedded Resources.

Gabe