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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

changing BackColor of particulars cells in a GridDataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

77935 Nov 21,2008 10:23 AM UTC Nov 25,2008 09:59 AM UTC WinForms 1
loading
Tags: FAQ
Administrator [Syncfusion]
Asked On November 21, 2008 10:23 AM UTC

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 09:59 AM UTC

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.

Warning Icon 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.Close Icon

;