﻿<?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 - Column aggregate to have a different DataFormatString to column</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Column-aggregate-to-have-a-different-DataFormatString-to-column/</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>Column aggregate to have a different DataFormatString to column</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Column-aggregate-to-have-a-different-DataFormatString-to-column/</link><pubDate>Sun, 20 Sep 2009 20:27:10 GMT</pubDate><dc:creator>Mark.R.P</dc:creator><description>&lt;p&gt;Thanks. This has solved my problem.&lt;/p&gt;</description></item><item><title>Column aggregate to have a different DataFormatString to column</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Column-aggregate-to-have-a-different-DataFormatString-to-column/</link><pubDate>Sun, 20 Sep 2009 20:18:33 GMT</pubDate><dc:creator>Mark.R.P</dc:creator><description>&lt;p&gt;Thanks. This has solved my problem.&lt;/p&gt;</description></item><item><title>Column aggregate to have a different DataFormatString to column</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Column-aggregate-to-have-a-different-DataFormatString-to-column/</link><pubDate>Fri, 18 Sep 2009 03:20:33 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;You could try using CustomAggegrate server side event to achieve this functionality. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;For example you would like to format UnitPrice column to have &lt;em&gt;c6&lt;/em&gt; format&lt;/p&gt;&lt;pre&gt;&amp;lt;ISWebGrid:WebGridColumn Caption="UnitPrice" DataMember="UnitPrice" DataType="System.Decimal" Name="UnitPrice" Width="150px" AggregateFunction="Custom" FooterText="Total : " DataFormatString="c6"&amp;gt;&lt;/pre&gt;
&lt;p&gt;Because we set the column to have an aggegrate custom we will need to implement CustomAggegrate server side event. In this event we could also have a different format string for the aggegrate column&lt;/p&gt;&lt;pre&gt;protected void WebGrid1_CustomAggregate(object sender, ISNet.WebUI.WebGrid.CustomAggregateArgs e)&lt;br /&gt;{&lt;br /&gt;    if (e.Column.Name == "UnitPrice")&lt;br /&gt;    {&lt;br /&gt;        // obtain the rows that need to be calculated&lt;br /&gt;        WebGridRowCollection rows = e.Rows;&lt;br /&gt;        Decimal total = 0;&lt;br /&gt;&lt;br /&gt;        // loop through all rows&lt;br /&gt;        foreach (WebGridRow row in rows)&lt;br /&gt;        {&lt;br /&gt;            total &amp;#43;= Decimal.Parse(row.Cells.GetNamedItem("UnitPrice").Value.ToString());&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        // pass the result back to AggregateResult.&lt;br /&gt;        e.AggregateResult = total.ToString("c2");&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Column aggregate to have a different DataFormatString to column</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Column-aggregate-to-have-a-different-DataFormatString-to-column/</link><pubDate>Fri, 18 Sep 2009 00:59:54 GMT</pubDate><dc:creator>Mark.R.P</dc:creator><description>&lt;p&gt;Is it possible for a column aggregate to have a different data format string to the column? I have a column whose DataFormatString ="c6" but I need the column aggregate to have DataFormatString="c2". Can you please provide code showing how this can be done? I am using WebGrid 7.0 with BatchUpdate enabled.&lt;/p&gt;</description></item></channel></rss>