Saturday, May 22, 2010

C# StyleSheet Object?

Hi All,





I am developing some asp.net pages where I am constructing the components on the fly. The two components I am using are the Infragistics UltraWebTab and UltraWebList control. Inside the tabs I am placing panels, images, items etc to build up content from a database.





I would like to skin these components using cascading style sheets which I have already created. The problem I am having his how to import and use the cascading style sheets using c#. I have examples from infragistics that suggest inserting the style sheets into the aspx page code but I may want to drive the skins using an XML file to set the skin name at a later date.





If someone could tell me which class to use to import/attach the css files I would be very grateful. Code samples or a link to examples would be much appreciated.





Thanks in advance





Jools

C# StyleSheet Object?
Interesting work you're doing.





You must be using .NET 1.1 because skins are already implemented in .NET 2.0.





Anyways, back to framework 1.1. the href is the part of the LINK tag that should be set at runtime so we use simple databinding.





1) In you aspx page use the following syntax


%26lt;LINK rev="stylesheet" type="text/css" rel="stylesheet"


href="%26lt;%# SelectedStyleSheet %%26gt;" %26gt;





In your code behind file:


1) declare the SelectedStyleSheet as a protected string - it doesnt work if its private


2) set the SelectedStyleSheet at runtime ex:


protected string SelectedStyleSheet = "./Style/Style.css";


3) Bind the Page (we are using simple DataBinding in the aspx page if you noticed instead of the %26lt;%= %%26gt; :


this.DataBind();





Best Regards
Reply:Try this http://www.developerfusion.co.uk/show/38...

augustifolia

No comments:

Post a Comment