Print Page | Close Window

Coloring Columns in a GridBuilder

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=926
Printed Date: 10-Jun-2026 at 8:46pm


Topic: Coloring Columns in a GridBuilder
Posted By: HFloyd
Subject: Coloring Columns in a GridBuilder
Date Posted: 27-Aug-2008 at 11:42am
Hello,

I have an entity called HouseholdBusiness which is related to Person (1-many people belong to a HouseholdBusiness). The PersonGridView includes some related columns from HouseholdBusiness:


AddId(descriptors.PersonGUID, "ID");
            AddNameReadOnly(descriptors.FirstName, "First");
            AddNameReadOnly(descriptors.MiddleName, "Middle");
            AddNameReadOnly(descriptors.LastName, "Last");
            AddNameReadOnly(descriptors.Title, "Title");
            AddNameReadOnly(descriptors.HouseholdBusiness.HBType.HBType, "Type");
            AddNameReadOnly(descriptors.HouseholdBusiness.HBName, "House/Biz");
            AddNameReadOnly(descriptors.HouseholdBusiness.City, "City");
            AddNameReadOnly(descriptors.HouseholdBusiness.State, "State");
            AddNameReadOnly(descriptors.HouseholdBusiness.Country, "Country");


The AllPeopleSearcher uses only the actual Person properties for searching:


public AllPeopleSearcher() : base()
        {
            SetContainsQueryTextColumns(
              Person.LastNameEntityColumn
              , Person.FirstNameEntityColumn
              , Person.MiddleNameEntityColumn
              , Person.TitleEntityColumn
              );
        }


I would like to use a visual cue so the user knows they are only searching certain types of data, though the other data is displayed. I thought a column color for the searched fields would be good, but am unsure how to implement this.

The DevExpress website has a code example for coloring a column:

gridView1.Columns["UnitPrice"].AppearanceCell.BackColor = Color.LightSteelBlue;
gridView1.Columns["UnitPrice"].AppearanceCell.BackColor2 = Color.Azure;
gridView1.Columns["UnitPrice"].AppearanceCell.ForeColor = Color.Black;



But since this is CAB, I don't have a direct reference to the gridview here. How/where can I implement code to achieve this result?

Thanks!
Heather



Print Page | Close Window