﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebGrid Enterprise - Font problem when changing style on row and cell</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Font-problem-when-changing-style-on-row-and-cell/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Font problem when changing style on row and cell</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Font-problem-when-changing-style-on-row-and-cell/</link><pubDate>Wed, 30 Jun 2010 05:06:48 GMT</pubDate><dc:creator>david.ahlen</dc:creator><category>Style</category><category>webgrid 7</category><category>Font</category><description>&lt;p&gt;Doh! I missed the 403 build. After I applied the hotfix it works as it should! &lt;/p&gt;
&lt;p&gt;Sorry, my mistake. Thanks for your help.&lt;/p&gt;
&lt;p&gt;/David&lt;/p&gt;</description></item><item><title>Font problem when changing style on row and cell</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Font-problem-when-changing-style-on-row-and-cell/</link><pubDate>Tue, 29 Jun 2010 22:18:20 GMT</pubDate><dc:creator>andi@intersoftpt.com</dc:creator><category>Style</category><category>webgrid 7</category><category>Font</category><description>&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;Hi David,&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; Forgive me, however I am not able to replicate your issue. Even when I set the style for the page body without set the font in InitializeRow, WebGrid will overwrite the style with its default style which in this case, the font will be using Segoe UI. At this moment, I am using WebGrid version 7 build 403.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; However, if you set the font family like I did (during the InitializeRow), does it also changes the font when you set any other stlye on the row on on the cell ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; I hope it helps. Thank you and have a nice day.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;Best Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;Andi Santoso&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Font problem when changing style on row and cell</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Font-problem-when-changing-style-on-row-and-cell/</link><pubDate>Tue, 29 Jun 2010 03:40:48 GMT</pubDate><dc:creator>david.ahlen</dc:creator><category>Style</category><category>webgrid 7</category><category>Font</category><description>&lt;p&gt;The thing is that I want the font to stay the same as the rest of the grid. And the problem is that the font changes anyway when I set any other style (like the background property) on the row and on the cell.&lt;/p&gt;
&lt;p&gt;I used the Monospace font on the page body to illustrate the problem that occurs in the grid.&lt;/p&gt;
&lt;p&gt;I attached a screenshot which looks pretty much like yours. However, I have &lt;strong&gt;not&lt;/strong&gt; set the cell font to Monospace. It happens anyway.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;David&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description></item><item><title>Font problem when changing style on row and cell</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Font-problem-when-changing-style-on-row-and-cell/</link><pubDate>Mon, 28 Jun 2010 22:29:08 GMT</pubDate><dc:creator>andi@intersoftpt.com</dc:creator><category>Style</category><category>webgrid 7</category><category>Font</category><description>&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;Hi David,&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; In this example, the changes will not be occured since we are using the default style. With this sets to true, it will take the default style as an important style and replace the other (which we declared on the outside of WebGrid).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; In your case, to have the font changes only for the yellow cells, we can simply add the font family during the InitializeRow server side event. Here is the snippet in order to do so:&lt;/span&gt;&lt;/p&gt;
&lt;p /&gt;&lt;pre&gt;&lt;span style="font-size: 9pt; "&gt;    protected void WebGrid1_InitializeRow(object sender, ISNet.WebUI.WebGrid.RowEventArgs e)
    {
        if (isEvenRow)
            e.Row.Style.BackColor = System.Drawing.Color.LightGray;

        bool isEvenColumn = true;
        foreach (WebGridCell cell in e.Row.Cells)
        {
            if (isEvenRow &amp;&amp; isEvenColumn)
            {
                cell.Style.BackColor = System.Drawing.Color.Yellow;
                &lt;/span&gt;&lt;b&gt;&lt;i&gt;&lt;span style="color: rgb(255, 0, 0); font-size: 9pt; "&gt;&lt;span style="font-size: 9pt; "&gt;cell.Style.Font.Name = "Monospace"&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9pt; "&gt;;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;span style="font-size: 9pt; "&gt;
            }
            isEvenColumn = !isEvenColumn;
        }

        isEvenRow = !isEvenRow;
    }&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; I also attached you my screenshot of this snippet, kindly take a look if it meets your scenario. I hope it can help you. Thank you and have a nice day.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;Best Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;Andi Santoso&lt;/span&gt;&lt;/p&gt;
&lt;p /&gt;</description></item><item><title>Font problem when changing style on row and cell</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Font-problem-when-changing-style-on-row-and-cell/</link><pubDate>Mon, 28 Jun 2010 10:07:36 GMT</pubDate><dc:creator>david.ahlen</dc:creator><category>Style</category><category>webgrid 7</category><category>Font</category><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I found what seems to be an issue with the font in the grid. &lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;As an example:&lt;/p&gt;&lt;pre&gt;&lt;pre&gt;&amp;lt;style type="text/css"&amp;gt;
body { font-family: Monospace; }
&amp;lt;/style&amp;gt;

&amp;lt;ISWebGrid:WebGrid ID="WebGrid1" runat="server" DefaultStyleMode="Silver"
    UseDefaultStyle="true"&amp;gt;
&amp;lt;/ISWebGrid:WebGrid&amp;gt;&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;&lt;/pre&gt;
&lt;p&gt;And in code behind:&lt;/p&gt;&lt;pre&gt;&amp;nbsp;&lt;pre&gt;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 &amp;amp;&amp;amp; isEvenColumn)
                    cell.Style.BackColor = System.Drawing.Color.Yellow;

	   isEvenColumn = !isEvenColumn;
	}

      	isEvenRow = !isEvenRow;
}&lt;/pre&gt;&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;Is there a solution to this?&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;David&lt;/p&gt;</description></item></channel></rss>