CSS sheets not working

T

tshad

In 2008, I have the following in my css script - this is not the actual
colors just something to find out why it won't work:
***************************************************
..Grid { border: solid 1px #FFFFFF; background-color:Red }
..Grid td
{
border: solid 1px #FFFFFF;
margin: 1px 1px 1px 1px;
padding: 1px 1px 1px 1px;
text-align: center;
}
..GridHeader
{
font-weight: bold;
background-color: #8b8dbb;
}
..GridItem
{
background-color: Green;
}

..GridAltItem
{
background-color: red;
}
********************************

In my .net page I have:

<head runat="server">
<title></title>
<link href="App_Data/AutoUPS.css" rel="stylesheet" type="text/css" />
</head>


It obviously sees it since which I put start typing "CSSClass=", it shows
the classes in the file.

I have the following:

<asp:GridView ID="GridView1"
OnRowDataBound="ItemDataBoundEventHandler1"
AutoGenerateColumns="False"
CssClass="Grid"
runat="server">
<AlternatingRowStyle CssClass="GridAltItem"/>
<RowStyle CssClass="GridItem" ForeColor="#0000FF"/>
<Columns>
<asp:BoundField DataField="ID" HeaderText="id"
SortExpressionID" />
<asp:BoundField DataField="Code" HeaderText="Code"
SortExpression="Code"/>
</Columns>
</asp:GridView>

But all I get is a black and white grid.

Why is that?

Thanks,

Tom
 
T

tshad

Also, if you look at it in Design view, it shows the Grid correctly with all
the colors applied.

But when you try to run it, all the styles are gone????

Thanks,

Tom
 
T

tshad

Not sure why this may have been the case, but I had the css in the App_Data
instead of the App_Themes which seemed to work fine in the Design screen but
not when run.

It all seems to work fine now when using a GridView.skin file which uses the
styles in my style sheets, except for my Labels. It is still showing as
large blue.

In View Source it shows as:

<tr class="GridItem"

Which I mentioned in another post. Obviously the color:Blue is overriding
the GridItem style which has color set to black. It obviously sees the
GridItem style and that is set to:

..Grid { border: solid 1px #FFFFFF;}
..Grid td
{
border: solid 1px #FFFFFF;
margin: 1px 1px 1px 1px;
padding: 1px 1px 1px 1px;
text-align: center;
}
..GridHeader
{
font-weight: bold;
background-color: #8b8dbb;
}
..GridViewRow
{
color:Black;
}
..GridViewAlternatingRow
{
color:Black;
}
..GridItem
{
background-color: #E9E9E9;
color:Black;
}

..GridAltItem
{
background-color: #FFFFFF;
color:Black;
}
So where does the style="color:Blue;" come from? I have just about
everything set to black.

My skin is:

<asp:GridView runat="server" SkinId="mGridViewSkin" >
<RowStyle CssClass="GridViewRow" />
<SelectedRowStyle CssClass="GridViewSelectedRow" />
<AlternatingRowStyle CssClass="GridViewAlternatingRow" />
<FooterStyle CssClass="GridViewFooter" />
<HeaderStyle CssClass="GridViewHeader" VerticalAlign="Bottom" />
<PagerStyle CssClass="GridViewPager" />
</asp:GridView>

Here is the start of my GridView. Labels only seem to be the problem. The
Textboxes seem to work OK but even they have small fonts.

<asp:GridView ID="GridView1"
AutoGenerateColumns="False"
SkinID="mGridViewSkin"
CssClass="Grid100"
AllowPaging="True"
AllowSorting="True"
PageSize="15"
PagerSettings-Mode="NumericFirstLast"
OnPageIndexChanged="mGridView_PageIndexChanged"
OnRowEditing="GridView1_RowEditing"
OnRowDataBound="ItemDataBoundEventHandler1"
runat="server"<AlternatingRowStyle CssClass="GridAltItem"/>
<RowStyle CssClass="GridItem" ForeColor="#0000FF"/>
<Columns>
<asp:TemplateField HeaderText="ID"
HeaderStyle-Width="40px" Visible="True">
<ItemTemplate>
<asp:Label ID="lblResponderFileExceptionID"
runat="server" Text='<%# Bind("ResponderFileExceptionID") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Tracking Code">
<ItemTemplate>
<asp:Label ID="lblTrackingCode"
runat="server" Text='<%# Bind("TrackingCode") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtTrackingCode"
runat="server" Width="40px" Text='<%# Bind("TrackingCode") %>' />
</EditItemTemplate>
</asp:TemplateField>

Is there some sort of setting I can't override?

Thanks,

Tom
 
T

tshad

It seems if I add a CSSClass to each Label, it works but not for the whole
GridView.

It doesn't make much sense.

If I have the color black set in the AlternatingRowStyle and RowStyle from
the GridViews markup as well as a different set of classes in the .skin file
which have the color at black, you would think that would make it black.

Thanks,

Tom
 
T

tshad

I found that if I added a new skin I can make it work, since the css doesn't
seem to work, nor does the GridView.skin as shown below work for the labels
(which are just span elements in IE).

I created a text.skin that has:

<asp:Label runat="server" Font-Bold="false" Style="Font-Family: Verdana,
Arial, Helvetica, sans-serif; Font-Size: xx-small" ForeColor="Black"
Text="Label"/>
<asp:TextBox runat="server" Font-Bold="false" Style="Font-Family: Verdana,
Arial, Helvetica, sans-serif; Font-Size: x-small" ForeColor="Black"/>

But this is for the whole page and not just the GridView.

I tried to add the above to the GridView.skin and took out the text.skin:

<asp:GridView runat="server" SkinId="mGridViewSkin" >
<RowStyle CssClass="GridViewRow" />
<SelectedRowStyle CssClass="GridViewSelectedRow" />
<AlternatingRowStyle CssClass="GridViewAlternatingRow" />
<FooterStyle CssClass="GridViewFooter" />
<HeaderStyle CssClass="GridViewHeader" VerticalAlign="Bottom" />
<PagerStyle CssClass="GridViewPager" />
<asp:Label runat="server" Font-Bold="false" Style="Font-Family: Verdana,
Arial, Helvetica, sans-serif; Font-Size: Large" ForeColor="Black"
Text="Label"/>
<asp:TextBox runat="server" Font-Bold="false" Style="Font-Family:
Verdana, Arial, Helvetica, sans-serif; Font-Size: x-small"
ForeColor="Black"/>
</asp:GridView>

But now my grid is all blue again.

I also found that my paging is also in large blue.

I want to use a different style for my Grid and the rest of the page.

How do I do that???

Thanks,

Tom
 
P

Patrice

App_Data is to store private data (such as a database file). So what you put
in this directoy won't be served by IIS hence likely your problem...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top