﻿<?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: Calculate a cell after a value is filled</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-Calculate-a-cell-after-a-value-is-filled/</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: Calculate a cell after a value is filled</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-Calculate-a-cell-after-a-value-is-filled/</link><pubDate>Mon, 22 Mar 2010 22:41:08 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;In my test, the column must be a bound column in order to set the text correctly. A workaround for your scenario would be modify the select query to include the Percentage Hours, for example&lt;/p&gt;&lt;pre&gt;SELECT ID, StandardHours, DirectHours, &lt;span style="color: rgb(255, 0, 0);"&gt;'' AS PercentageHours&lt;/span&gt;&lt;br /&gt;FROM Hours&lt;/pre&gt;&lt;p&gt;Initially you could use the InitializeRow server side event in order to fill the percentage hours cell.&lt;/p&gt;
&lt;p&gt;Attached is the demonstration of the workaround.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>How-to: Calculate a cell after a value is filled</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-Calculate-a-cell-after-a-value-is-filled/</link><pubDate>Mon, 22 Mar 2010 11:04:40 GMT</pubDate><dc:creator>bdenison</dc:creator><description>&lt;p&gt;No it's an unbound column. since the Standard Hours and the Direct Hours are stored in the database, there is no need to store the percentage. I just need the calculation change to appear in another column after any changes to the other two fields. I assume I will need to have the same calc for the initialization of the grid.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Are there any settings that need to be set on the grid or column property in order for unbound columns to appear? Do I need to switch from server side binding to client side binding?&lt;/p&gt;</description></item><item><title>How-to: Calculate a cell after a value is filled</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-Calculate-a-cell-after-a-value-is-filled/</link><pubDate>Mon, 22 Mar 2010 03:47:23 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;My test show that using the snippet you provided will allow us to update the &lt;em&gt;DirectPct&lt;/em&gt; column correctly. The test will displayed the updated &lt;em&gt;DirectPct&lt;/em&gt; value correctly in the WebGrid. The test is already using the latest WebGrid 7 build and WebUI Framework 3, build 402 and build 752&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Does the update you meant in your post is the update process to the database? &lt;br /&gt;&lt;/p&gt;</description></item><item><title>How-to: Calculate a cell after a value is filled</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-Calculate-a-cell-after-a-value-is-filled/</link><pubDate>Mon, 22 Mar 2010 00:04:47 GMT</pubDate><dc:creator>bdenison</dc:creator><description>&lt;p&gt;I am trying use this example to get an Excel like ability for a grid. The code calculates correctly, and there are no errors. However the grid cell does not update? is there something I am missing?&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;
function&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 13px"&gt; WebGridDetail_OnExitEditMode(controlId, tblName, editObject) { &lt;/span&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;var&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 13px"&gt; grd = ISGetObject(controlId); &lt;/span&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;var&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 13px"&gt; cell = wgGetCellByElement(editObject.cellElement); &lt;/span&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;var&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 13px"&gt; colName = cell.Name; &lt;/span&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 13px"&gt; (colName == &lt;/span&gt;&lt;span style="color: #a31515; font-size: 13px"&gt;&lt;span style="color: #a31515; font-size: 13px"&gt;"DirectHours"&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 13px"&gt;) { &lt;/span&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;var&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 13px"&gt; row = cell.Row; &lt;/span&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;var&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 13px"&gt; stdhours = parseFloat(row.GetCells().GetNamedItem(&lt;/span&gt;&lt;span style="color: #a31515; font-size: 13px"&gt;&lt;span style="color: #a31515; font-size: 13px"&gt;"StandardHours"&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 13px"&gt;).Text); &lt;/span&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;var&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 13px"&gt; dirhours = parseFloat(editObject.element.value); &lt;/span&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 13px"&gt; (stdhours == 0) { &lt;p&gt;result = 0; &lt;/p&gt;&lt;p&gt;} &lt;/p&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;else&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 13px"&gt; { &lt;p&gt;result = dirhours/stdhours * 100;&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;row.GetCells().GetNamedItem(&lt;/span&gt;&lt;span style="color: #a31515; font-size: 13px"&gt;&lt;span style="color: #a31515; font-size: 13px"&gt;"DirectPct"&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 13px"&gt;).SetText(String(result), &lt;/span&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;true&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 13px"&gt;); &lt;/span&gt;&lt;span style="font-size: 13px"&gt;  &lt;/span&gt;</description></item></channel></rss>