Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

My Theme/Skin file is not being applied to controls

Status
Not open for further replies.

uberpudge

Technical User
Mar 15, 2002
63
US
I am tinkering with Themes for the first time.

I am designing in Visual Web Developer Express Edition 2005.
I am running this on Vista Home Premium.

I am deploying on the same box which is running IIS7 and has the following options installed:
--IIS 6 Management Compatibility (All options checked)
--IIS Management Console
--.NET Extensibility
--ASP
--ASP.Net
--ISAPI Extensions
--ISAPI Filters
--Default Document
--Directory Browsing
--HTTP Errors
--Static Content
--HTTP Logging
--Request Monitor
--Static Content Compression
--IP Security
--Request Filtering

--------------
I have entered the following in my web.config file:

<system.web>
<pages styleSheetTheme="DW6" />
--------------
I have the theme defined in the file tree as:

App_Themes \ DW6
--------------
I have a "GridView.skin" file which looks like this:

<%--
Default skin template. The following skins are provided as examples only.

1. Named control skin. The SkinId should be uniquely defined because
duplicate SkinId's per control type are not allowed in the same theme.

<asp:GridView runat="server" SkinId="gridviewSkin" BackColor="White" >
<AlternatingRowStyle BackColor="Blue" />
</asp:GridView>

2. Default skin. The SkinId is not defined. Only one default
control skin per control type is allowed in the same theme.

<asp:Image runat="server" ImageUrl="~/images/image1.jpg" />
--%>
<asp:GridView runat="server" CellPadding="5" GridLines="Horizontal">
<PagerStyle BackColor="#C0C0FF" />
<SelectedRowStyle BackColor="#C0FFC0" />
<HeaderStyle BackColor="#C0C0FF" />
<AlternatingRowStyle BackColor="#FFE0C0" />
</asp:GridView>
--------------
Relevant page code from the page with a gridview:

<%@ Page Language="VB" MasterPageFile="~/MasterPages/dw6.master" AutoEventWireup="false"
CodeFile="Default.aspx.vb" Inherits="_Default" Title="Conditions" %>

<asp:Content ID="contentMain" ContentPlaceHolderID="cphMain" runat="Server">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="Condition_ID" DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="Condition_ID" HeaderText="Condition_ID" InsertVisible="False"
ReadOnly="True" SortExpression="Condition_ID" />
<asp:CheckBoxField DataField="Type" HeaderText="Type" SortExpression="Type" />
<asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
</Columns>
</asp:GridView>
</asp:Content>
--------------

The VDW2005 Designer renders the control correctly (e.g., skin file applied to control), however when I run the page from VDW2005 (localhost:randomport/site) or when I run the page from the deployment server, no formatting whatsoever is applied.

Does anyone have an idea as to what I am doing wrong?
I have googled this extensively and cannot find anything even remotely relevant.

Any assistance to point me in the right direction (or solve it outright) will be greatly appreciated.

Hope this helps,
Pete
 
I forgot to mention that I am using the "ASP.NET 2.0 CSS Friendly Control Adapters 1.0" as well, which as it turns out is the cause of all of this malarkey.

I excluded the "CSSFriendlyAdapters.browser" file from the project (to temporarily disable the CSS Friendly rendering) to debug a CSS problem I am having, and lo and behold, the GridView.skin file was applied on the next render.

When I re-include the "CSSFriendlyAdapters.browser" file, the GridView.skin file is not used again, so the problem has to be somewhere in the GridViewAdapter.vb class.

Has anyone run into this before?

Hope this helps,
Pete
 
I am using themes on our intranet in the same manner you are:

<pages styleSheetTheme="DW6" />

The best I can offer is that when you use "styleSheetTheme" vs. "Theme" is that the skin files and cooresponding css will cascade like a stylesheet. The Friendly Control Adapters will have a place in the cascading hierarchy, and is apparently overriding whatever you set up in the skin.

I did not reference anything for this... this is simply my experience with it.

You can try giving your skin an ID and referencing the SkinID in the grid tag if you want to utilize the skin. This may, in essence, increase the specificity of the css you are applying via the skin.

Good luck!

Mark
 
I've tried the "styleSheetTheme" vs. "Theme" with no success.

After a review of the output of the page with the CSSFriendlyAdapters.browser file excluded from the project contrasted to output of the page with the CSSFriendlyAdapters.browser file included with the project, I can only conclude that the problem is in the GridViewAdapter.vb file under App_Code \ Adapters.

Without the CSSFriendlyAdapters.browser enabled, the GridView renders to the page with most of the GridView.skin file applied as inline "style=" attributes.
Excluded from the inline "style=" attributes are things like "cellpadding" which is a table attribute, not a CSS property.

I reviewed the code in GridViewAdapter.vb and at no point does it render a "style=" attribute, and it explicitly sets things like "cellpadding" to "0" (see quoted code below).
--------------------
Sampled from GridViewAdapter.vb in the "RenderContents" method:
writer.WriteBeginTag("table")
writer.WriteAttribute("cellpadding", "0")
writer.WriteAttribute("cellspacing", "0")
--------------------

It seems my only options are to further extend the GridViewAdapter.vb class to render style attributes, or try a CSS-only approach.

As I can do a CSS-only approach faster (extending the GridViewAdapter.vb class is a little outside my current skillsets, but not by much), I will probably wind up doing that.

Thank you for your suggestion.
I welcome any further insight into this apparent oversight.

Hope this helps,
Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top