View Single Post
 
Old March 27th, 2013, 04:09 PM
grandma grandma is offline
Authorized User
Points: 56, Level: 1
Points: 56, Level: 1 Points: 56, Level: 1 Points: 56, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2013
Location: Topeka, KS
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Default GridView css not working

My question has to do with Beginning ASP.NET 3.5 in C# and VB. however when I post in that forum, my question simply disappears after a few hours. I have addressed this problem to tech support and got no answer, so I am trying this.

In chapter 14 the GridView on the Genre page does not respond to the css formatting. I cannot see where the error is.

Here is my markup for the Genres page:

Code:
<%@ Page Language="VB" MasterPageFile="~/MasterPages/ManagementMaster.master" AutoEventWireup="false" CodeFile="Genres.aspx.vb" Inherits="Management_Genres" title="Planet Wrox - Management - Genres" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
    DataKeyNames="Id" DataSourceID="SqlDataSource1" 
    EmptyDataText="There are no data records to display." AllowPaging="True" 
        AllowSorting="True" CellPadding="4" ForeColor="#333333" GridLines="None">
        
    <Columns>
        <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
            ShowSelectButton="False" ItemStyle-Width="100px" />
       
        <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" ItemStyle-Width="200px" />
        <asp:BoundField DataField="SortOrder" HeaderText="SortOrder" 
            SortExpression="SortOrder" />
    </Columns>
  
</asp:GridView>
        &nbsp;
        <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
            DataKeyNames="Id" DataSourceID="SqlDataSource1" DefaultMode="Insert" 
            Height="50px" Width="125px">
            <Fields>
                <asp:BoundField DataField="Id" HeaderText="Id" InsertVisible="False" 
                    ReadOnly="True" SortExpression="Id" />
                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                <asp:BoundField DataField="SortOrder" HeaderText="SortOrder" 
                    SortExpression="SortOrder" />
                <asp:CommandField ShowInsertButton="True" />
            </Fields>
        </asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:PlanetWroxConnectionString1 %>" 
    DeleteCommand="DELETE FROM [Genre] WHERE [Id] = @Id" 
    InsertCommand="INSERT INTO [Genre] ([Name], [SortOrder]) VALUES (@Name, @SortOrder)" 
    ProviderName="<%$ ConnectionStrings:PlanetWroxConnectionString1.ProviderName %>" 
    SelectCommand="SELECT [Id], [Name], [SortOrder] FROM [Genre]" 
    UpdateCommand="UPDATE [Genre] SET [Name] = @Name, [SortOrder] = @SortOrder WHERE [Id] = @Id">
    <DeleteParameters>
        <asp:Parameter Name="Id" Type="Int32" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter Name="Name" Type="String" />
        <asp:Parameter Name="SortOrder" Type="Int32" />
    </InsertParameters>
    <UpdateParameters>
        <asp:Parameter Name="Name" Type="String" />
        <asp:Parameter Name="SortOrder" Type="Int32" />
        <asp:Parameter Name="Id" Type="Int32" />
    </UpdateParameters>
</asp:SqlDataSource>
</ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
Here is the Management.css:

Code:
*
{
	font-family: Verdana, Arial, Sans-Serif;
}

body
{
	font-size: 80%;
}

.GridView, .GridView a
{
	color: #000;
}

.GridViewHeaderStyle, .GridViewPagerStyle, .GridViewEditRowStyle
{
	background-color: #bee4cf;
}

.GridViewAlternatingRowStyle
{
	background-color: #e1e1e1;
}

.GridViewHeaderStyle
{
	text-align: left;
}

.GridViewHeaderStyle a
{
	text-decoration: none;
}
and here is GridView.skin:

Code:
<asp:GridView runat="server" CssClass="GridView">
    <PagerStyle CssClass="GridViewPagerStyle" />
    <HeaderStyle CssClass="GridViewHeaderStyle" />
    <EditRowStyle CssClass="GridViewEditRowStyle" />
    <AlternatingRowStyle CssClass="GridViewAlternatingRowStyle"/>  
</asp:GridView>
I am getting a warning about "no build provider registered for the extension 'skin'" I realize that is not a fatal error, but I don't recall seeing it when I worked with other skin files in this book.

And yes I did set the pages theme="Management" in the web.config file.