﻿<?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 - How to change cell fore color on lost focus of the cell in WebGrid ?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-change-cell-fore-color-on-lost-focus-of-the-cell-in-WebGrid-/</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>How to change cell fore color on lost focus of the cell in WebGrid ?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-change-cell-fore-color-on-lost-focus-of-the-cell-in-WebGrid-/</link><pubDate>Thu, 20 May 2010 21:57:13 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;In my test for both FireFox 3.6.3 and Safari 4.0.5 I found that the method will work without any issue. The edited cell will have a red color as the result of the snippet.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>How to change cell fore color on lost focus of the cell in WebGrid ?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-change-cell-fore-color-on-lost-focus-of-the-cell-in-WebGrid-/</link><pubDate>Thu, 20 May 2010 05:33:01 GMT</pubDate><dc:creator>desaigs81</dc:creator><description>&lt;p&gt;This solution is not working for Firefox and Safari.&lt;/p&gt;</description></item><item><title>How to change cell fore color on lost focus of the cell in WebGrid ?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-change-cell-fore-color-on-lost-focus-of-the-cell-in-WebGrid-/</link><pubDate>Thu, 08 Apr 2010 00:01:09 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;WebGrid will rewrite the style and class name after updating a row. If you wish to preserve the style you set during ExitEditMode client side event you will need to buffer the modified style during BeforeUpdate client side event handler and re-apply the style during AfterUpdate client side event handler. Here is the snippet, I am using class name to modify the edited cell:&lt;/p&gt;&lt;pre&gt;var EditedCell = "";&lt;br /&gt;var KeyValue = "";&lt;br /&gt;&lt;br /&gt;function wgTest_OnExitEditMode(controlId, tblName, editObject)&lt;br /&gt;{&lt;br /&gt;	var wgTest = ISGetObject(controlId);&lt;br /&gt;&lt;br /&gt;	editObject.cellElement.className &amp;#43;= " Edited-Cell";&lt;br /&gt;	&lt;br /&gt;	return true;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function wgTest_OnBeforeUpdate(controlId, tblName, rowObject)&lt;br /&gt;{&lt;br /&gt;	var wgTest = ISGetObject(controlId);&lt;br /&gt;    &lt;br /&gt;	var rowStruct = ["ID", "Name", "Author", "Category"];&lt;br /&gt;	for (var i = 0; i &amp;lt; rowStruct.length; i&amp;#43;&amp;#43;)&lt;br /&gt;	{&lt;br /&gt;	    var className = rowObject.GetCell(rowStruct[i]).CellElement.className;&lt;br /&gt;	    if (className.indexOf("Edited-Cell") &amp;gt; 0)&lt;br /&gt;	    {&lt;br /&gt;	        EditedCell &amp;#43;= rowStruct[i] &amp;#43; ";";&lt;br /&gt;	    }&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	KeyValue = rowObject.KeyValue;&lt;br /&gt;	EditedCell = EditedCell.length &amp;gt; 0 ? EditedCell.substr(0, EditedCell.length - 1) : EditedCell;&lt;br /&gt;	&lt;br /&gt;	return true;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function wgTest_OnAfterUpdate(controlId, tblName, rowObject, xmlResponseObject)&lt;br /&gt;{&lt;br /&gt;	var wgTest = ISGetObject(controlId);&lt;br /&gt;&lt;br /&gt;	setTimeout(function()&lt;br /&gt;	{&lt;br /&gt;	    var rowEditObj = wgTest.RootTable.GetRowByKeyValue(KeyValue);&lt;br /&gt;	    var rowStruct = EditedCell.split(";");&lt;br /&gt;	    for (var i = 0; i &amp;lt; rowStruct.length; i&amp;#43;&amp;#43;)&lt;br /&gt;	    {&lt;br /&gt;	        rowEditObj.GetCell(rowStruct[i]).CellElement.className &amp;#43;= " Edited-Cell";&lt;br /&gt;	    }&lt;br /&gt;	    EditedCell = "";&lt;br /&gt;	    KeyValue = "";&lt;br /&gt;	}, 10);&lt;br /&gt;	&lt;br /&gt;	return true;&lt;br /&gt;}&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>How to change cell fore color on lost focus of the cell in WebGrid ?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-change-cell-fore-color-on-lost-focus-of-the-cell-in-WebGrid-/</link><pubDate>Wed, 07 Apr 2010 04:54:14 GMT</pubDate><dc:creator>desaigs81</dc:creator><description>&lt;p&gt;We are using WebGrid 7.0 in SharePoint web part where we are rendering the web part programatically. &lt;/p&gt;
&lt;p&gt;We have inline editing enabled in our web grid where we are allowign users to enter  data. We want to change font color to (E.g. To RED) after cell editing is done and the focus is moved out of the cell being edited.&lt;/p&gt;
&lt;p&gt;We have used the following JavaScript code for the same:&lt;/p&gt;&lt;pre&gt;function WebUIGrid_OnExitEditMode(controlId, tblName, editObject) 
{
    editObject.cellElement.style.color = "red";
    return true;
}&lt;/pre&gt;

&lt;p&gt;But after this gets executed, the server side event "UpdateRow" gets executed and it changes the color back to the default color. So we tried to set the forecolor as Red with the following code written in  WebGrid_UpdateRow serverside event:&lt;/p&gt;&lt;pre&gt;WebGridRow modifiedRow = e.Row;
            WebGridCellCollection cellCollection = modifiedRow.Cells;
            for(int cellCount = 0; cellCount &amp;lt; cellCollection.Count; cellCount&amp;#43;&amp;#43;)
            {
                if (cellCollection[cellCount].DataChanged)
                    cellCollection[cellCount].Style.ForeColor = Color.Red;
            }&lt;/pre&gt;

&lt;p&gt;But the problem with this approach is that if we change Cell 6, moves the focus out of this row, this code gets executed and cell 6 becomes red in color. Next (Before saving the values) if we change Cell 7 of the same row then we will find only Cell 7 in red and Cell 6 gets the default fore color.&lt;/p&gt;
&lt;p&gt;Any help on this would be greatly appreciable.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;</description></item></channel></rss>