Hello,
I am using the "Teleric C# Web Application" template for my project, and I am defining the skin in the web.config.
For 98% of my application, the theme arrangements of the skin are suitable. I need to display a grid of normalized data of two related entities and the requirement is that the columns that represent the respective entities are different colors. I need to set these values in two places ... on the web page and in the excel export. I have some code samples below.
What I need is to be able to find some reference to a skin element (like the row color/alternate row color) and set these properties to the respective html color of that element to avoid the hard-coded values and not disconnect visual elements from the theme.
Thanks.
The grid cell background:
The excel table cells were more difficult to get to, but I this works for me:
I am using the "Teleric C# Web Application" template for my project, and I am defining the skin in the web.config.
For 98% of my application, the theme arrangements of the skin are suitable. I need to display a grid of normalized data of two related entities and the requirement is that the columns that represent the respective entities are different colors. I need to set these values in two places ... on the web page and in the excel export. I have some code samples below.
What I need is to be able to find some reference to a skin element (like the row color/alternate row color) and set these properties to the respective html color of that element to avoid the hard-coded values and not disconnect visual elements from the theme.
Thanks.
The grid cell background:
BasicGrid.Columns[0].ItemStyle.BackColor = System.Drawing.ColorTranslator.FromHtml("#ffffcc");The excel table cells were more difficult to get to, but I this works for me:
protected void BasicGrid_ExcelExportCellFormatting(object sender, ExcelExportCellFormattingEventArgs e){ if (e.Cell.UniqueID.Contains("ctl")) { TableCell cell = e.Cell as TableCell; int columnId = -1; String uniqueid = e.Cell.UniqueID.Split('$').Last(); if (Int32.TryParse(uniqueid.Replace("ctl", ""), out columnId)) { if (columnId <= this._midPoint + 1) { cell.Style["text-align"] = "left"; cell.Style["background-color"] = "#ffffcc";
//Needs to be the row color of the applied theme } else { cell.Style["text-align"] = "right"; cell.Style["background-color"] = "#ccffcc";
//Needs to be the row alternate color of the applied theme } } }}