Reputation: 1
I want to make an html editor like ajax editor. I mean to say everything is merged in a single dll(images,javascript,class).
How to accomplish this.
Plz Help
Upvotes: 0
Views: 651
Reputation: 4112
This Microsoft KB article is really a good reference for how to do this and if you read this article closely, you'll also see a way to "perform substitution" within text-based embedded resources like CSS and JavaScript files as well. The WebResource attribute has a PerformSubstitution property that, if set to true, will allow you to use WebResource URLs inside of your embedded resources. This gives you the ability to reference embedded images within CSS selectors in the embedded CSS file.
In the AssemblyInfo file, you'd specify PerformSubstitution like this:
[assembly: WebResource("SimpleControl.MyScript.js", "text/javascript", PerformSubstitution = true)]
Inside the JavaScript file, you can use this bit of code to access a specific resource by name as it is in the assembly (namespace and all):
<%= WebResource("SimpleControl.smallSuccess.gif")%>
In general ASP.NET server controls that do default skinning (take Telerik's controls as an example) have everything embedded in the assembly. I have written several controls that use this technique in the past and in current projects and it works very well. If your CSS is written properly, you can even allow good overriding of the styling external to the controls to allow further customization to the provided defaults and/or skins.
Upvotes: 2
Reputation: 1039298
You could use WebResourceAttribute. This article might be helpful as well.
Upvotes: 0