Jul 10, 2012, 1:31 PM
[CLOSED] changing the background color for gridPanel's column not working
Hi,
I am trying to set the Cls property to a CSS class to change the GridPanel's Column background color but it is not working. It works if I set
For example, in my example the background color for Comany,Price,Change and last update does not get changed if even I set
Can you please show me how to change the column background color - for both the label text and field object?
Below is my code for your review. Thanks in advance for your help.
I am trying to set the Cls property to a CSS class to change the GridPanel's Column background color but it is not working. It works if I set
StyleSpec ="background: Green;"
but I need to use a CSS so that I can change all the field's colors in one location.For example, in my example the background color for Comany,Price,Change and last update does not get changed if even I set
Cls="highlightDetails"
.Can you please show me how to change the column background color - for both the label text and field object?
Below is my code for your review. Thanks in advance for your help.
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<head>
<style type="text/css">
.highlightDetails
{
background-color:Green !Important;
}
</style>
</head>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
this.Store1.DataSource = this.Data;
this.Store1.DataBind();
}
}
private object[] Data
{
get
{
return new object[]
{
new object[] { "3m Co", 71.72, 0.02, 0.03, "9/1 12:00am" },
new object[] { "Alcoa Inc", 29.01, 0.42, 1.47, "9/1 12:00am" },
new object[] { "Altria Group Inc", 83.81, 0.28, 0.34, "9/1 12:00am" },
new object[] { "Wal-Mart Stores, Inc.", 45.45, 0.73, 1.63, "9/1 12:00am" }
};
}
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>background color - Ext.NET Examples</title>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Panel ID="FormPanelRunDetails" runat="server" Layout="FitLayout" AutoScroll="false">
<Items>
<ext:GridPanel ID="GridPanel1" runat="server" Title="Array Grid" Width="600" Height="175">
<Store>
<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="company" />
<ext:ModelField Name="price" Type="Float" />
<ext:ModelField Name="change" Type="Float" />
<ext:ModelField Name="pctChange" Type="Float" />
<ext:ModelField Name="lastChange" Type="Date" DateFormat="M/d hh:mmtt" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:Column ID="Column1" runat="server" Cls="highlightDetails" Text="Company" DataIndex="company" Flex="1" />
<ext:Column ID="Column2" runat="server" Cls="highlightDetails" Text="Price" DataIndex="price">
</ext:Column>
<ext:Column ID="Column3" runat="server" Cls="highlightDetails" Text="Change" DataIndex="change">
</ext:Column>
<ext:Column ID="Column4" runat="server" Cls="highlightDetails" Text="Change" DataIndex="pctChange">
</ext:Column>
<ext:DateColumn ID="DateColumn1" Cls="highlightDetails" runat="server" Text="Last Updated" DataIndex="lastChange" />
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" >
</ext:RowSelectionModel>
</SelectionModel>
</ext:GridPanel>
</Items>
</ext:Panel>
</body>
</html>
Last edited by Daniil; Jul 13, 2012 at 7:23 PM.
Reason: Please use [CODE] tags, [CLOSED]