iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hi,
I want to add a Column in WebGrid whose value will be calculated based on the value from other columns.
e.g. Gross Amount = Unit Price * Qty
Net Amount = Gross Amount -Discount
Please check following samples that available in WebGridSamples project.
AutomaticGroupFooterUpdate.aspx
This sample shows the total of grouped column in group footer. By enabling the GroupTotalVisible feature (GrouptTotalVisible=”True”, for more detail, please check line 11 of AutomaticGroupFooterUpdate.aspx file), WebGrid will shows the group footer. Next, you can simply shows the subtotal of the freight column by using the built-in aggregate function of WebGrid (AggregateFunction=”Sum” and FooterText=”Sum: “, for more detail, please check line 36 of AutomaticGroupFooterUpdate.aspx file).
BatchUpdate_Enterprise.aspx
This is the enterprise sample of BatchUpdate WebGrid. The sample uses hierarchical grid of [Customers] – [Orders] – [OrderDetails] of Northwind database. On [OrderDetails] child table, there is a column called “SubTotal”. This column is not available on the Northwind database. The column generated on dataset level, based on the following expression/formula: [Quantity]*[UnitPrice]-([Quantity]*[UnitPrice]*Discount). For more detail information about the formula, please check the “Expression” property of SubTotal DataColumn in dsEnterprise.xsd dataset file.
On OnInitialize client side event of the grid, CreateFormula() method is invoked. CreateFormula() method is used to creates a formula in order to calculate the value of a cell, in this case is the “SubTotal” cell of OrderDetails table. For more detail information about this, please check line 17 of BatchUpdate_Enterprise.aspx file.
On the column footer of “SubTotal” column, there is also the result of sum aggregate of the “SubTotal” column. This can be achieved simply by enabling ColumnFooters feature (ColumnFooters=”Yes”, for more detail, please check line 180 of BatchUpdate_Enterprise.aspx sample) of LayoutSettings; set the AggregateFunction of “SubTotal” column to “Sum” (AggregateFunction=”Sum”, for more detail, please check line 69 of BatchUpdate_Enterprise.aspx file). You may change the column footer text by setting the FooterText property (for more detail, please check line 71 of BatchUpdate_Enterprise.aspx file).
BuiltinAggregation.aspx
This sample shows the sum of UnitsInStock column; max value of UnitPrice column; and average value of UnitsOnOrder column by using the built-in aggregate of WebGrid.
CellFormula.aspx
This sample demonstrates how WebGrid can be binded to expression-based column. In this sample, Products table that is bind to WebGrid, does not have TotalAsset column. TotalAsset is an expression-based column, which formula is specified in dsNorthwind.cs file.
DisplayAggregateinGroupHeader.aspx
This sample demonstrates the ability to display basic aggregate functions in group header. Although built-in Aggregate Functions are available in WebGridColumn, you need to enable GroupTotal feature. When enabled, a special total row will appear after the group header to display each calculated values of aggregate functions defined in specific WebGridColumn.
Enterprise.aspx
The explanation of this sample is identic with the BatchUpdate_Enterprise.aspx sample file.
GroupFooterTotal.aspx
The result of aggregate function can also be shown in group footer total.
You can also check the new sample of ClientBinding_PreloadGroupTotals.aspx.
Could you please let us know which one of the sample that suit your scenario at most so that we can assist you better on the functionality and the feature? Or if you have different scenario, please feel free to contact us.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname