CodeVerge.Net Beta
Login Idy
Register Password
  Forgot?
Explore    Item Entry    Profile   
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML





Zone: > newsgroup > asp.net forum > microsoft_downloads.css_friendly_control_adapters Tags:
Item Type: NewsGroup Date Entered: 11/1/2006 2:15:57 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 11 Views: 15 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
12 Items, 1 Pages 1 |< << Go >> >|
Padgett
Asp.Net User
Serving suggestion11/1/2006 2:15:57 AM

0/0

I’d like to make a suggestion in regards to how this project is packaged.  This is aimed at those who want to add Css based controls to their existing project and are not concerned with how it all works.  In addition to your source and example packages, I’d love to see a ‘redistributable’ package.  This would contain just the elements needed to override the rendering of the controls.  I see this as being:

a)       A single dll with which to reference in our existing projects.  This dll contains all the code and resources for the control adapters.

b)       A .browser file that tells our projects to use the control adapters in the referenced assembly

 

Is this do-able?

 

Overall this project is excellent.  In my opinion this is how the asp.net controls should have been built in the first place.

Russ Helfand
Asp.Net User
Re: Serving suggestion11/1/2006 3:25:40 PM

0/0

This is a great idea. I know of a few people who have already implemented it.  I'll contact one of them, Polita Paulus, who is part of the ASP.NET team, to see if she can post some notes on how exactly to do this packaging yourself.

I understand that you'd prefer for MS to do this DLL construction for you and merely distribute it in a future rev of the kit.  I'll keep that in mind but Polita's (or others') recipe for how to do this can help you and others right now.  So, let's try to get a detailed set of instructions posted here if we can.

Again, thanks for the insight on how you'd prefer the kit packaged.  It's a good idea.


Russ Helfand
Groovybits.com
HardyE
Asp.Net User
Re: Serving suggestion11/1/2006 8:08:53 PM

0/0

Hi!

For the release of the Blinq prototype I compiled the necessary adapter resources into a dll to keep the project files clear of unrelated adapter code so developers would be able to concentrate on the core Blinq files. The CSS Adapters were in an early stage at the time but the principle can just as well be applied to the current release.

The way to go about "pre-packaging" the adapters resources into a single dll is as follows:

1. Create a class-library project in Visual Studio. Name it "CSSAdapters". This will hold the resources and code files which will eventually be turned into the dll.

2. Add a "CSS Friendly ASP.NET Control Adapters" web site to the solution in Visual Studio.

3. Reference the class library project from the Adapters project. This will ensure the output of the class library project will be copied to the Adapter project's "bin" directory.

4. Move (don't copy) the following folders and their contents from the Adapters project to the dll project:
- App_Code/Adapters
- CSS
- JavaScript
The .cs/.vb files can be moved to the root directory of the class library project, but I recommend leaving the .css and .js files in their respective folders. The steps below assume this is the case.

5. Open the file "AssemblyInfo.cs" of the class library project. You will need add to this file in the next step.

6. Turn the CSS and JavaScript files residing in the "CSS" and "JavaScript" directories of the class library project into embedded resources:
a) Select a file in Solution Explorer.
b) In the properties window set its build action to "Embedded Resource".
c) Add a WebRessourceAttribute decoration for the resource of step a to "AssemblyInfo.cs". For JavaScript files this must look as follows:

[assembly: WebResource("CssAdapters.JavaScript.AdapterUtils.js", "application/x-javascript")]

For CSS files the format would be:

[assembly: WebResource("CssAdapters.CSS.Menu.css", "text/css")]


The first parameter of the WebResourceAttribute expects the following syntax: ProjectNamespace.Foldername.Filename.FileExtension. Note that this is strictly case-sensitive, i.e. the casing of the resource files must match the parameter's value exactly.
d) Repeat steps a to c for each CSS and JavaScript file.

7. Now adjust the C#/VB code in the adapter classes to retrieve the resources from the assembly instead of the file system. The method you need here is

ClientScriptManager.GetWebResourceUrl , which which you could use as follows:

Page.ClientScript.GetWebResourceUrl(GetType(), "CssAdapters.CSS.Menu.css"));  

Use this call to GetWebResourceUrl() anywhere a file system path to the respective resource is required by the adapter class.

Following the above steps will package the CSS and JavaScript resources into a single dll along with the adapter classes. Please be aware that once the files are embedded in the dll you will have to recompile and upload the assembly to your web server each time you make a change to the CSS and JavaScript files.

Hint: the tricky part in making embedded resources work is to figure out the exact value for the first parameter of WebResourceAttribute . If you get the casing wrong, retrieval of the resource will fail silently. No exception will be thrown, the file is simply not served. A helpful method to figure out the correct string for the resource is to set the build action for all the resources to "Embedded Resource" as in step 6b and then compile the dll. Then open the dll you just compiled in ildasm.exe and double-click on the "MANIFEST" section. Somewhere you will find entries that look similarly to this:

.mresource public CSSAdapters.CSS.Menu.css
{
  // Offset: 0x00000E50 Length: 0x000006F7
}

The value after .mresource public is the precise string you have to pass to the WebResourceAttribute in step 6c.

Hope this helps.

Regards,

Hardy Erlinger

Further reading on embedded resources in ASP.NET 2.0:

http://www.nikhilk.net/WebResourceAttribute.aspx

http://msdn2.microsoft.com/en-us/library/system.web.ui.webresourceattribute.aspx


Netspectrum
INETA Germany
Padgett
Asp.Net User
Re: Serving suggestion11/2/2006 12:12:36 AM

0/0

HardyE - this sounds perfect, I will give it a go.  Cheers for the detailed response.
bdemarzo
Asp.Net User
Re: Serving suggestion11/16/2006 3:42:00 PM

0/0

Inspired by this topic, I wrote a compiled version of the beta 3.0 CSSAdapters. You can read about it and download it from my blog site at http://demarzo.net/archive/2006/11/16/1037.aspx.

- brian
- blog: www.sidesofmarch.com
Thacker
Asp.Net User
Re: Serving suggestion11/17/2006 12:00:47 AM

0/0

bdemarzo---

Your compiled dll and supplied files within your zip are excellent.  This will greatly ease deployment.  Re-compiling the dll for adjustments and later revisions to the adapters and associated files is going to be a breeze.  It keeps things simple and stupid.  It is great.  Thanks very much, ladies and gentlemen. 

bdemarzo
Asp.Net User
Re: Serving suggestion11/17/2006 3:01:01 AM

0/0

Thanks for the kind words -- I'm glad you (and hopefully many others!) find it as helpful as I do. I'll keep updating the compiled distribution to coincide with the latest changes from Microsoft until they do it for me. Wink

 


- brian
- blog: www.sidesofmarch.com
michiel1978
Asp.Net User
Re: Serving suggestion1/29/2007 9:23:45 AM

0/0

Hello bdemarzo,

your site is currently down, is this temporary? If not, would you consider moving the project to sourceforge or codeplex so we always have access and others can help with the maintenance?

Thanks! 


When you ask a question, remember to click "mark as answered" when you get a reply which answers your question; this ensures the right forum member gets credit below for being helpful (and makes search more relevant too).
bdemarzo
Asp.Net User
Re: Serving suggestion1/29/2007 3:15:10 PM

0/0

My server crashed and I haven't had time to repair it. Should be back in a week or so.

I will look into adding it to CodePlex this week.


 


- brian
- blog: www.sidesofmarch.com
michiel1978
Asp.Net User
Re: Serving suggestion1/30/2007 8:08:42 PM

0/0

Just realized you might not be allowed to post the source to Codeplex because you altered it (Microsoft Permissive License)?
When you ask a question, remember to click "mark as answered" when you get a reply which answers your question; this ensures the right forum member gets credit below for being helpful (and makes search more relevant too).
bdemarzo
Asp.Net User
Re: Serving suggestion1/30/2007 8:16:23 PM

0/0

michiel1978:
Just realized you might not be allowed to post the source to Codeplex because you altered it (Microsoft Permissive License)?

Good point. ScottGu commented on my posting of the compiled adapters, which means he's familiar with what I did (and supportive of it). I'll ask him if he has suggestions.

 


- brian
- blog: www.sidesofmarch.com
bdemarzo
Asp.Net User
Re: Serving suggestion2/26/2007 7:51:46 PM

0/0

For those still interested in this, there's a few developments...



- brian
- blog: www.sidesofmarch.com
12 Items, 1 Pages 1 |< << Go >> >|



Search This Site:


Meet Our Sponsors:



Other Resources:

suggestion for approach/controls - borland.public.cppbuilder.vcl ... suggestion for approach/controls, > ROOT > NEWSGROUP > Borland Forums > ... Approach Controls are quite large serving several busy airports while others are ...
HTTP serving multiple WAS profiles on the same machine. - ibm.software ... HTTP serving multiple WAS profiles on the same machine., > ROOT > NEWSGROUP > IBM Software > ... suggestions for authenticating against an existing database ...
MySpace.com - Serving Suggestion - Cape Town, ZA - Indie / Rock - www ... MySpace music profile for Serving Suggestion with tour dates, songs, videos, pictures, blogs, band information, downloads and more
Serving suggestion - Wikipedia, the free encyclopedia Serving suggestion is a disclaimer used on food packaging. ... As a disclaimer a serving suggestion also serves to remove any legal obligation ...
Gorean Serving Suggestions These are ryella's suggestions for serving food and drinks. ... That means serving can include: bringing drinks and food, engaging in ...
Serving Suggestions For Life Read this entry or view more from Serving Suggestion Of The Day ... Serving Suggestion Of the Day. Suburban Sirens. Virtual Scrapbook. Recipes + Potions ...
Serving Suggestions Serving Suggestions. I have tried all of those ideas below and here are some more of my favorites... C.C. Submit your serving suggestion: Click Here ...
SeaBear Wild Salmon - Wild Alaskan Smoked Salmon Featuring wild Alaskan smoked salmon, crab, Alaskan halibut, prawns, chowders and more, shipped direct ... Serving Suggestions. Seafood Cooking & Grilling ...
Miles of Chocolate Serving suggestions. What others are saying. Contact us. News, Events, and Press ... Reheat to warm before serving. ... Refrigerate until serving. ...
Serving Suggestion - NexTag.com Compare cheap prices for Serving Suggestion at NexTag.com. Shop for bargain appliances, furnishings, and more for your kitchen, bedroom, bathroom, and backyard.


 
All Times Are GMT