Hi,
I have the following Grid:
<div>
@(Html.EJ().Grid<SlimHub.Models.QuoteSimulationPlantCost>("QuoteSimulationPlantCostsGrid")
.Datasource(ds => ds.Json((IEnumerable<QuoteSimulationPlantCost>)Model.QuoteSimulationPlantCosts.ToList()).UpdateURL("../PlantCostEqUpdate").InsertURL("../PlantCostEqInsert").RemoveURL("../PlantCostEqDelete").Adaptor(AdaptorType.RemoteSaveAdaptor))
.ShowSummary()
.SummaryRow(row =>
{
row.Title("Totale").SummaryColumns(col => { col.SummaryType(SummaryType.Sum).Format("{0:C}").DisplayColumn("TotalPrice").DataMember("TotalPrice").Add(); }).Add();
})
.EditSettings(edit =>
{
edit.AllowAdding().AllowDeleting().AllowEditing();
})
.Locale("it-IT")
.ToolbarSettings(toolbar =>
{
toolbar.ShowToolbar().ToolbarItems(items =>
{
items.AddTool(ToolBarItems.Add);
items.AddTool(ToolBarItems.Edit);
items.AddTool(ToolBarItems.Delete);
items.AddTool(ToolBarItems.Update);
items.AddTool(ToolBarItems.Cancel);
}).CustomToolbarItems(
new List<object>() {
//new Syncfusion.JavaScript.Models.CustomToolbarItem() {TemplateID = "#Details"},
new Syncfusion.JavaScript.Models.CustomToolbarItem() {TemplateID = "#Details"}});
})
.AllowResizing()
.AllowTextWrap(true)
.Columns(col =>
{
col.Field("PlantCostId").HeaderText("ID").HeaderTextAlign(TextAlign.Center).IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(40).Visible(false).Add();
col.Field("QuoteSimId").HeaderText("ID Simulazione").HeaderTextAlign(TextAlign.Center).DefaultValue(Model.QuoteSimId).Width(100).Visible(false).Add();
col.Field("EquipmentId").HeaderText("Attrezzatura").ForeignKeyField("EquipmentId").ForeignKeyValue("EquipmentDesc").DataSource((IEnumerable<object>)ViewBag.Equipments).HeaderTextAlign(TextAlign.Center).Width(45).Add();
col.Field("Quantity").HeaderText("Quantità").HeaderTextAlign(TextAlign.Center).TextAlign(TextAlign.Right).Format("{0:n1}").Width(80).Add();
col.Field("UnitPrice").HeaderText("Prezzo Unitario").HeaderTextAlign(TextAlign.Center).TextAlign(TextAlign.Right).Format("{0:c2}").Width(80).Add();
col.Field("TotalPrice").HeaderText("Prezzo Totale").HeaderTextAlign(TextAlign.Center).TextAlign(TextAlign.Right).Format("{0:c2}").AllowEditing(false).Width(80).Add();
//col.Field("TotalPrice").HeaderText("Prezzo Totale").HeaderTextAlign(TextAlign.Center).TextAlign(TextAlign.Right).Format("{0:c2}").AllowEditing(false).Width(80).Add();
col.Field("Annotations").HeaderText("Note").HeaderTextAlign(TextAlign.Center).Width(80).Add();
})
.ClientSideEvents(eve =>
{
eve.ActionComplete("PlantComplete");
eve.Create("PlantGridCreate");
eve.ToolbarClick("PlantToolBarClick");
})
)
</div>
</div>
</div>
*********************
CRUD METHOD
*********************
public ActionResult PlantCostEqUpdate(QuoteSimulationPlantCost value)
{
if (value.Quantity != null && value.UnitPrice != null)
{
value.TotalPrice = value.Quantity*value.UnitPrice;
}
else
{
value.TotalPrice = null;
}
db.Entry(value).State = EntityState.Modified;
db.SaveChanges();
return Json(value, JsonRequestBehavior.AllowGet);
}
When I double click on a grid row and change the note value, the CRUD method is called with the numeric values Quantity and Unit Price not formatted, that is without comma or dot. So, quantity 10,0 is passed as 100, Unit Price of euro 100,00 is passed as 10000. The CRUD methos calculates the total price as Quantity*UnitPrice and returns 100000 euro.
The attached file explains better.
How can I solve this issue?
Thanks.
Attachment:
issue_(2)_bf737b16.zip