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.

changing BackColor of particulars cells in a GridDataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

77935 Nov 21,2008 05:23 AM Nov 25,2008 04:59 AM Windows Forms 1
loading
Tags: FAQ
Administrator [Syncfusion]
Asked On November 21, 2008 05:23 AM

Hi,
I've a GridDataBoundGrid with a datable for datasource.

I want to change the backColor and the borders of particulars cells.

I can access to this cells with
gridName(cell.RowIndex, cell.ColIndex)

but it's not working when I try to change the style of the cell.

I try to do this :
- in the sub new, after the affectation of the datasource
- in the sub form_Load
- in a sub who handles gridName.DrawCell
- in a sub who handles gridName.DrawCellBackground
- in a sub who handles gridName.DrawCurrentCellBorder

But nothing is working.

How must I do ?



Jisha Joy [Syncfusion]
Replied On November 25, 2008 04:59 AM

Hi,

Thank you for posting query to us.

You have to handle QueryCellInfo to apply cell specific styles in GridDataBoundGrid. You can check for the Colindex and RowIndex to track the specific cell and set the styles.

Please refer the code:

//Event
this.gridDataBoundGrid1.Model.QueryCellInfo += new Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventHandler(Model_QueryCellInfo);

//Event Handler

void Model_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e)
{
if (e.ColIndex == 2 && e.RowIndex == 2)
{
e.Style.BackColor = Color.BlueViolet;
e.Style.Borders.All = new GridBorder(GridBorderStyle.DashDotDot, Color.DarkCyan);
}
}

Please let me know if this helps.

Regards,
Jisha


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.

;