set css dynamically in a cell from code behind

Page 1 of 2 12 LastLast
  1. #1

    set css dynamically in a cell from code behind

    Hello,
    I have a GridPanel in which I have to set cell color of every cell differently for a particular column. How can i do it.

    <ext:Store ID="stPriorityList" runat="server">
                                        <Reader>
                                            <ext:JsonReader ReaderID="PRIORITY_ID_PK">
                                                <Fields>
                                                    <ext:RecordField Name="PRIORITY_NAME_VC" />
                                                    <ext:RecordField Name="COLOUR_HEX_CODE_VC" />
                                                    <ext:RecordField Name="DESCRIPTION_VC" />
                                                    <ext:RecordField Name="ACTIVE_FLAG_VC"  />
                                                </Fields>
                                            </ext:JsonReader>
                                        </Reader>
                                    </ext:Store>
                                    <ext:GridPanel ID="gpPriorityUser" runat="server" StoreID="stPriorityList" Width="680"
                                        AutoHeight="true" Collapsible="true" Title="Priority List">
                                        <ColumnModel ID="cmEndUser" runat="server">
                                            <Columns>
                                                <ext:Column Header="Priority Name" DataIndex="PRIORITY_NAME_VC" ColumnID="Identifier">
                                                    <Renderer Fn="IdentifierRender" />
                                                </ext:Column>
                                                <ext:Column Header="Description" DataIndex="DESCRIPTION_VC" />
                                                <ext:Column Header="Color" DataIndex="COLOUR_HEX_CODE_VC"  />
                                                <ext:Column Header="Active" DataIndex="ACTIVE_FLAG_VC" />
                                            </Columns>
                                        </ColumnModel>                           
                                    </ext:GridPanel>
    Now i want to set different color for every row of Color Header different from code behind.

    Thanks in advance.
    Last edited by Daniil; Feb 22, 2012 at 7:46 AM. Reason: Please use [CODE] tags
  2. #2
    Hi,

    Hope the following example help.
    http://forums.ext.net/showthread.php...ll=1#post52989
  3. #3
    hello, I want these color will be set through database i.e HEXcolorCode value for that color.
  4. #4
    You should set up:
    metadata.css = "color: " + yourColor;
    within a Column Renderer.
  5. #5
    it cant identify <ext:ResourceManager runat="server" /> and this.grid.colModel.
  6. #6
    I don't understand, please clarify.
  7. #7
    it gives compile error
              Coolite.Ext.Web.ResourceManager' is inaccessible due to its protection level
    when i am using
    <ext:ResourceManager runat="server" />
    it also canot identify this.grid.colModel. as a link suggested by you.

    i am using
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    is it fine with this.
    Last edited by Daniil; Feb 22, 2012 at 8:55 AM. Reason: Please use [CODE] tags
  8. #8
    Well, it looks that you use Coolite 0.8.

    The example is for Ext.NET v1.x.
  9. #9
    Hello, now I am using Ext.NET.
    I have work on your example. but it is called on cellclick event but I want cellcolor to be set on page load. This cellcolor will be different for each row and it will get value from its color code from database... it is not just red green or blue it may be multiple color.

    waiting for reply...
    Thanks...
  10. #10
    Good point to use Ext.NET v1.

    Regarding to your requirement.

    You should set up
    metadata.attr = "color='" + someColor + "'";
    within a Column Renderer.
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 0
    Last Post: Mar 27, 2012, 10:01 AM
  2. Replies: 0
    Last Post: Aug 30, 2011, 2:48 PM
  3. [CLOSED] [1.0] Dynamically format GridCommand cell and button
    By betamax in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Jan 19, 2011, 6:19 PM
  4. Replies: 1
    Last Post: Jul 21, 2010, 12:52 AM
  5. Replies: 2
    Last Post: Feb 19, 2009, 2:02 PM

Tags for this Thread

Posting Permissions