We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GridGroupingControl

Hi,

i am assigning the data and appearance
(i-e Font , Colheder appearance and cell
apperance) using the "TableModel" object of GridGroupingControl.

for examle,
objGridgroupingControl.Table.TableMode.ColCount=4

But the value of ColCount of GridGroupingControl
does not change.
Why?

Regards
Naveed Afzaal

3 Replies

AD Administrator Syncfusion Team May 3, 2007 10:26 PM UTC

Hi Naveed,

You can apply the appearance settings for ColumnheaderCell and RecordFieldcell using the below code snippet.


//Applies the TextColor settings for both ColumnHeader and RecordFieldCell
this.GridGroupingControl1.TableDescriptor.Appearance.ColumnHeaderCell.TextColor = Color.DimGray;
this.GridGroupingControl1.TableDescriptor.Appearance.AnyRecordFieldCell.TextColor = Color.DimGray;

//Applies the Font settings for ColumnHeadercell
this.GridGroupingControl1.TableDescriptor.Appearance.ColumnHeaderCell.Font.Facename = "Monotype Corsiva";

Attached is the sample for your ready references.

http://websamples.syncfusion.com/samples/Grid.Web/5.1.0.0/F60359/GridGroup_Forum60359/main.htm

this.GridGroupingControl1.Table.TableModel.ColCount will always holds the number of columns in the Grid. Changing it doesn't make any sense. i.e "ColCount" will get changed only when the new columns are get added to GridGroupingControl.

Let us know if you need any other help.

Thanks for using Syncfusion products.

Regards,
Gokulkumar B


NA Naveed Afzaal May 4, 2007 06:02 AM UTC

Hi Gokulkumar B,

The sample u have given applies apperance to all cloumns and data in table.

There are three things which i want to achieve.

1) I want to apply apperance settings on column Header ( i-e font , Color ,Bold). These settings varies from column to column in a grid.

2) I want to apply the currency(i-e $,#) to all cell values for a particular column.

3) I want to apply the apperance properties
(i-e back color,font) to "selective" cell values of a column in a grid.

How can i do above all?

Regards
Naveed Afzaal

>Hi Naveed,

You can apply the appearance settings for ColumnheaderCell and RecordFieldcell using the below code snippet.


//Applies the TextColor settings for both ColumnHeader and RecordFieldCell
this.GridGroupingControl1.TableDescriptor.Appearance.ColumnHeaderCell.TextColor = Color.DimGray;
this.GridGroupingControl1.TableDescriptor.Appearance.AnyRecordFieldCell.TextColor = Color.DimGray;

//Applies the Font settings for ColumnHeadercell
this.GridGroupingControl1.TableDescriptor.Appearance.ColumnHeaderCell.Font.Facename = "Monotype Corsiva";

Attached is the sample for your ready references.

http://websamples.syncfusion.com/samples/Grid.Web/5.1.0.0/F60359/GridGroup_Forum60359/main.htm

this.GridGroupingControl1.Table.TableModel.ColCount will always holds the number of columns in the Grid. Changing it doesn't make any sense. i.e "ColCount" will get changed only when the new columns are get added to GridGroupingControl.

Let us know if you need any other help.

Thanks for using Syncfusion products.

Regards,
Gokulkumar B


GB Gokul B Syncfusion Team May 5, 2007 01:47 AM UTC

Hi Naveed,

Thanks for your update.

Here is my answer for your query.

* Below sequence of code snippet will answers your (1) and (3) query.

GridTableDescriptor desc = this.GridGroupingControl1.TableDescriptor;
//Applies the Color and Font setting based on the Columnn Index
desc.Columns[0].Appearance.ColumnHeaderCell.TextColor = Color.Red;
desc.Columns[1].Appearance.ColumnHeaderCell.Font.Facename = "MS Serif";

//Applies the Color and Font setting based on the Columnn Name
desc.Columns.FindByMappingName("Title").Appearance.ColumnHeaderCell.TextColor = Color.RosyBrown;
desc.Columns.FindByMappingName("Address").Appearance.ColumnHeaderCell.Font.Facename = "Impact";

* You can apply the dollar ($) values based on columns using QueryStyleInfo event which occurs for each cell before it gets rendered. Please have a look at our below code for your references.

protected void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
{
if (e.TableCellIdentity.Column.MappingName == "Title")
{
String str = e.Style.Text;
e.Style.Text = str + "$";

}
}
}

Let us know if you need any other help.

Regards,
Gokulkumar B

Loader.
Live Chat Icon For mobile
Up arrow icon