Font problem when changing style on row and cell

4 replies. Last post: June 30, 2010 5:06 AM by David
Tags :
  • New Discussion
  • New Question
  • New Product Feedback
David Member

Hello,

I found what seems to be an issue with the font in the grid.

When changing the style of a row and a cell programmatically the text does not get the correct font. Instead of the font used in the WebGrid it gets the standard font of the page.

As an example:

<style type="text/css">
body { font-family: Monospace; }
</style>

<ISWebGrid:WebGrid ID="WebGrid1" runat="server" DefaultStyleMode="Silver"
    UseDefaultStyle="true">
</ISWebGrid:WebGrid>

 

And in code behind:

 
bool isEvenRow = true;

void WebGrid1_InitializeRow(object sender, RowEventArgs e)
{
	if (isEvenRow)
                e.Row.Style.BackColor = System.Drawing.Color.LightGray;

	bool isEvenColumn = true;
	foreach (WebGridCell cell in e.Row.Cells)
	{
 	   if (isEvenRow && isEvenColumn)
                    cell.Style.BackColor = System.Drawing.Color.Yellow;

	   isEvenColumn = !isEvenColumn;
	}

      	isEvenRow = !isEvenRow;
}

 

This example will change the background color of every even row (gray) and every even cell (yellow). At least for me the yellow cells will have Monospace as font while the rest of the cells will have the WebGrid font.

Is there a solution to this?

 

Regards,

David

All times are GMT -5. The time now is 11:54 AM.
Previous Next