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

Export to Html

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();
Regards
Ali


1 Reply

JS Jeba S Syncfusion Team 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:
http://websamples.syncfusion.com/samples/Grid.Windows/F67598/main.htm

Kindly let us know if you need any further assistance.

Thank you for using Syncfusion Products.

Best Regards,
Jeba.

Loader.
Live Chat Icon For mobile
Up arrow icon