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

Export to Html

Thread ID:





67598 Aug 24,2007 12:46 PM UTC Sep 4,2007 06:11 AM UTC WinForms 1
Tags: GridControl
Faheem Rauf
Asked On August 24, 2007 12:46 PM UTC

Hi, I am Exporting a GridDataBoundGrid to HTML. I want to apply colors to specific columns. First two columns should have red color, and remaining columns should be green. Please guide me how can I achieve such a functionality?

tempGrid.DataSource = objDataTable;
tempGrid[1,1].BackColor = Color.Red;
string strHtml = ExportAsHTML(rL).ToString();

Jeba S [Syncfusion]
Replied On September 4, 2007 06:11 AM UTC

Hi Ali,

Sorry for the delay in response.

You can change the backcolor of a particular column by using the GridDataBoundGrid.Model.ColStyles[index].BackColor property. Setting the back color property for by specifying its row index and column index value will work only for the grid control. And as for the GridDataBoundGrid you need to use ColStyles property in order to change the back color for a specific column.

this.gridDataBoundGrid1.Model.ColStyles[1].BackColor = Color.Red;
this.gridDataBoundGrid1.Model.ColStyles[2].BackColor = Color.Red;

this.gridDataBoundGrid1.Model.ColStyles[3].BackColor = Color.Green;
this.gridDataBoundGrid1.Model.ColStyles[4].BackColor = Color.Green;

Please refer the sample which implements the above:

Kindly let us know if you need any further assistance.

Thank you for using Syncfusion Products.

Best Regards,


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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