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.
Unfortunately, activation email could not send to your email. Please try again.

How to set cells background color

Thread ID:

Created:

Updated:

Platform:

Replies:

52180 Nov 23,2006 03:27 AM Nov 23,2006 05:58 AM Windows Forms 6
loading
Tags: GridControl
Tannearu Hazarathaiah Gupta
Asked On November 23, 2006 03:27 AM

Hi,

I am using syncfusion GridDataBoundGrid. I want set back colors following criteria.


(Cells that are editable shoule have a white background and celss that are not editable should have light grey back round.)

Please resolve the problem ASAP.


Reagrds
Tannearu Hazarathaiah

Administrator [Syncfusion]
Replied On November 23, 2006 03:52 AM

Hi Tannearu,

To set cell specific properties in a GridDataBoundGrid, you must catch the PrepareViewStyleInfo event (or Model.QueryCellInfo event). In your handler, you check e.RowIndex and e.ColIndex, and if these point to the cell you want to change, you set e.Style.BackColor/Style.Readonly to the value you want.

Please refer to the following KBs for more details.
How do I change the Backcolor of a single cell in a GridDataBoundGrid
How do I make the Cells Read-only in GridDataBoundGrid?


Best Regards,
Haneef

Tannearu Hazarathaiah Gupta
Replied On November 23, 2006 04:48 AM

Hi Haneef,
Thanks for your Reply. I Need Particular Solution following criteria.

I check the progrmatically about cell behaviour and Change his backround Color. I don't want set Design time values.

I nedd check at runtime about the cell type is read only and Set Background Color. Please help me. This urgent.


Thanks
Tannnearu Hazartahaiah




>Hi Tannearu,

To set cell specific properties in a GridDataBoundGrid, you must catch the PrepareViewStyleInfo event (or Model.QueryCellInfo event). In your handler, you check e.RowIndex and e.ColIndex, and if these point to the cell you want to change, you set e.Style.BackColor/Style.Readonly to the value you want.

Please refer to the following KBs for more details.
How do I change the Backcolor of a single cell in a GridDataBoundGrid
How do I make the Cells Read-only in GridDataBoundGrid?


Best Regards,
Haneef

Tannearu Hazarathaiah Gupta
Replied On November 23, 2006 05:01 AM

Hi Haneef,
Thanks for your reply. But i Need to find out each cells Behaviour and set color at the load of the grid it self. is ther any code sniffet is avilabe give me reply asap.


Cheers
Tannearu Hazartahaiah

>Hi Haneef,
Thanks for your Reply. I Need Particular Solution following criteria.

I check the progrmatically about cell behaviour and Change his backround Color. I don't want set Design time values.

I nedd check at runtime about the cell type is read only and Set Background Color. Please help me. This urgent.


Thanks
Tannnearu Hazartahaiah




>Hi Tannearu,

To set cell specific properties in a GridDataBoundGrid, you must catch the PrepareViewStyleInfo event (or Model.QueryCellInfo event). In your handler, you check e.RowIndex and e.ColIndex, and if these point to the cell you want to change, you set e.Style.BackColor/Style.Readonly to the value you want.

Please refer to the following KBs for more details.
How do I change the Backcolor of a single cell in a GridDataBoundGrid
How do I make the Cells Read-only in GridDataBoundGrid?


Best Regards,
Haneef

Tannearu Hazarathaiah Gupta
Replied On November 23, 2006 05:22 AM

Hi Haneef,
Thanks For your reply. But I Need set the Background color in the runtime Means i Have to check the cells Status means Editable or NotEditable. How to check it out its editable or Not Editable at runtime. Please resolve the problem.

Regards
Tannearu

>Hi Haneef,
Thanks for your reply. But i Need to find out each cells Behaviour and set color at the load of the grid it self. is ther any code sniffet is avilabe give me reply asap.


Cheers
Tannearu Hazartahaiah

>Hi Haneef,
Thanks for your Reply. I Need Particular Solution following criteria.

I check the progrmatically about cell behaviour and Change his backround Color. I don't want set Design time values.

I nedd check at runtime about the cell type is read only and Set Background Color. Please help me. This urgent.


Thanks
Tannnearu Hazartahaiah




>Hi Tannearu,

To set cell specific properties in a GridDataBoundGrid, you must catch the PrepareViewStyleInfo event (or Model.QueryCellInfo event). In your handler, you check e.RowIndex and e.ColIndex, and if these point to the cell you want to change, you set e.Style.BackColor/Style.Readonly to the value you want.

Please refer to the following KBs for more details.
How do I change the Backcolor of a single cell in a GridDataBoundGrid
How do I make the Cells Read-only in GridDataBoundGrid?


Best Regards,
Haneef

Administrator [Syncfusion]
Replied On November 23, 2006 05:35 AM

Hi Tannearu,

Use the Readonly property to find the editiable cell in a grid. Here is a code snippet to show this.

private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if( e.Style.ReadOnly )
e.Style.BackColor = Color.Gray;
else
e.Style.BackColor = Color.AliceBlue ;
}

Please refer to the attached sample for implementation.
GDBGReadonlyCellType.zip

Best Regards,
Haneef

Tannearu Hazarathaiah Gupta
Replied On November 23, 2006 05:58 AM

Hi Haneef,

Thanks. Its working.

Regards
Tannearu Hazarathaiah




>Hi Tannearu,

Use the Readonly property to find the editiable cell in a grid. Here is a code snippet to show this.

private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if( e.Style.ReadOnly )
e.Style.BackColor = Color.Gray;
else
e.Style.BackColor = Color.AliceBlue ;
}

Please refer to the attached sample for implementation.
GDBGReadonlyCellType.zip

Best Regards,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;