Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / IDE / January 2008

Tip: Looking for answers? Try searching our database.

CSS Properties and Themes in vs2008

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bruce Browning - 06 Dec 2007 17:20 GMT
Although the CSS in my Theme folder is being applied when my pages are
displayed.  The CSS properties feature doesn't seem to be able to pick these
up.  

What must I do to get the ide to see the CSS styles in my themes folder?

Thanks
rlm - 26 Dec 2007 20:39 GMT
I have the same type of problem. A project that worked fine in VS2005 now has
a compile error everywhere it referenced a custom class in my css file. The
background specified in the same file is showing through from the master page.

I have discovered that if I create a new web form(not a web content form),
the classes are seen ok, and the CSS style Manager shows them all fine. But I
can't get them working on my web content form at all.

Additionally, the code behind for the page is not recognizing the controls
on the page either.
rlm - 27 Dec 2007 16:59 GMT
This problem stems from the fact that master pages are only rendered with the
corresponding content pages. Start with a  new project and create a theme
with a stylesheet, and add a custom class to the stylesheet. Now on a content
page try to assign the class element of some object to your css custom class.
VS2008 will not recognize it and will give compile warnings and not render it
properly. There are several solutions.
1.    On the content page which references the css classes, use the properties
drop down to select document, and choose your StyleSheetTheme. It should now
render properly , even in design view, and recognize those classes.
2.    In the web.config file set the page styleSheetTheme property. You will
find it in the system.web element as below. After rebuilding the project it
should render properly in design and live, but you will still have the
warnings that the class is not defined.
<system.web>
    <pages styleSheetTheme="TestTheme">
3.    Another way is to reference the sheet directly in the content page.  In
your “head” content holder place a reference like the one below. Then the
page should render correctly and the warnings should go away.
<link id="link1" rel="stylesheet" href="App_Themes\TestTheme\testStyle.css"
type="text/css" runat="server" />
4.    The other solution is to take the same link as in number three above and
put it in the master page in the html head element. This will also render
correctly, and will eliminate the warnings.
<head runat="server">
<link id="link1" rel="stylesheet" href="App_Themes\TestTheme\testStyle.css"
type="text/css" runat="server" />
</head>
rlm - 28 Dec 2007 13:10 GMT
I still have not figured out why option number one works on a new project,
but will not work on this project brought over from vs2005. If anyone has
figured this out please share it with us.

> There are several solutions.
> 1.    On the content page which references the css classes, use the properties
> drop down to select document, and choose your StyleSheetTheme. It should now
> render properly , even in design view, and recognize those classes.
Chad Scharf - 12 Jan 2008 06:31 GMT
Please ensure that the "theme" property within the <pages/> tag in your
web.config specifies a valid folder under your App_Themes directory and that
the case matches (Themes and CSS classes are case sensitive).  Setting both
of these properties properly in your web.config file should resolve the
issues without much fuss for your 2005 to 2008 converted web projects.

From the MSDN documentation, the styleSheetTheme property, "Specifies the
name of the "named theme" folder to be used to apply the theme before control
declarations, in contrast with the theme attribute that defines the theme to
apply after the control declaration."

and the theme property, "Specifies the name of the theme that is used for
the pages that are within the scope of the configuration file. The specified
theme must exist as either an application or a global theme. If the theme
does not exist, an HttpException exception is thrown."

Having an invalid or non-case matching theme name in either of these
attributes could also invalidate the VS2008 designer validation algorithms
and/or cause build errors. If you set these values in your web.config, you
should consider removing all references to Theme or StyleSheetTheme from the
<%@ Page %> directive at the top of any pages that you've used the designer
to modify unless you explicitly plan on using a different theme for different
pages within the same configuration scope.

If you are still experiencing issues let me know and I'll see what I can
help out with. I've converted 5 web projects from VS2005 to VS2008 in the
past 2 months that use Themes without any issues and both theme and
styleSheetTheme are set in the web.config file.

Thanks,
Signature

Chad Scharf
_______________________________
http://www.chadscharf.com

> I still have not figured out why option number one works on a new project,
> but will not work on this project brought over from vs2005. If anyone has
[quoted text clipped - 4 lines]
> > drop down to select document, and choose your StyleSheetTheme. It should now
> > render properly , even in design view, and recognize those classes.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.