This question is locked. New answers and comments are not allowed.
What is the BEST way to group data by an expression within a grid? I am not looking for a "nested grouping" but grouping of mulitple columns in "one group". When it appears in the UI, it should appear as "one group" not as a "nested group". I see in RadGrid for ASP.NET AJAX has GridGroupByExpression.
I am currently achieving the results I need the following way:
Within the MVC View (as shown below) I group by a calculated column "FinancialChargeType" which is of data type string.
<% Html.Telerik().Grid<Main.Areas.BuildingPermit.Models.InquireFee>(Model.Fees) .Name("fees") .DataKeys(keys => { keys.Add(o => o.Fee.BAFeeID); }) .Columns(columns => { columns.Bound(o => o.Fee.FeeCategoryDescription).Title("Fee Category").HtmlAttributes(new { @style = "text-align:left;" }); columns.Bound(o => o.Fee.FeeDescription).Title("Fee Description").HtmlAttributes(new { @style = "text-align:left;" }); columns.Bound(o => o.Fee.CalculatedDollarAmount).Title("Amount").HtmlAttributes(new { @style = "text-align:right;" }); }) .Groupable(grouping => grouping.Groups(groups => { groups.Add(c => c.FinancialChargeType); //groups.Add(c => c.Transaction.ReceiptNumber); //groups.Add(c => c.Transaction.ReceiptDate); })) .DataBinding(dataBinding => dataBinding .Server() .Select("InquirePermit", "InquirePermit", new { TabIndex = 4 })) .Render(); %>The column "FinancialChargeType" value is a concatenation of values from the desired columns I want to group by. Below is the LINQ to SQL statement:
var fees = (from f in ctx.BAFees join tt in ctx.FinancialTransactions on f.FinancialTransactionID equals tt.FinancialTransactionID join bp in ctx.BuildingPermits on tt.LMReferenceNumber equals bp.PermitNumber where bp.PermitID == PermitID select new InquireFee { Fee = f, Transaction = tt, TransactionType = tt.FinancialChargeType, FinancialChargeType = string.Format("{0} Receipt #: {1} {2}", tt.FinancialChargeType.FinancialChargeTypeDescription, tt.ReceiptNumber, tt.ReceiptDate) }).ToList();The result is the following:
-> Financial Charge Type: Permit Fee - Receipt #: R1030176-3/0001 11/16/2010 11:22:00 AM
I appreciate you time and assistance. Please advise.
Barbara Rivera