Hello,
I have an edit template for the edit popup in the grid,
but when I make update some fields are empty, the bind doesn't work.
This is the view:
@model OrdiniCRA.ViewModels.Customers.OrderDetailViewModel
<br />
@Html.AntiForgeryToken()
@Html.HiddenFor(model => model.PurchaseOrdId)
@Html.HiddenFor(model => model.Position)
@Html.HiddenFor(model => model.Line)
@Html.HiddenFor(model => model.Supplier)
@Html.HiddenFor(model => model.TotalAmount)
<div id="ch" class="col-md-offset-4 col-md-10">
@(Html.Kendo().CheckBox().Name("ArtFornit").Checked(false).Label("Filtra per articolo fornitore").HtmlAttributes(new { onchange = "updateMsg();" }))
</div>
<div class="col-md-offset-4 col-md-8">
@Html.Label("Tipo Riga")
</div>
<div class="col-md-offset-4 col-md-8">
@Html.Kendo().DropDownListFor(m => m).DataTextField("Text").Name("LineType").DataValueField("Text").Value("MERCE").Events(e => e.Select("onSelect")).BindTo(new List<SelectListItem>() {
new SelectListItem() {
Text = "MERCE",
Value = "3538947"
},
new SelectListItem() {
Text = "NOTA",
Value = "3538944"
}
}).Value("MERCE")
@Html.ValidationMessageFor(model => model.LineType)
</div>
<div id="lart" class="col-md-offset-4 col-md-8">
@Html.LabelFor(model=>model.Item)
</div>
<div class="col-md-offset-4 col-md-8">
@(
Html.Kendo().ComboBoxFor(m => m.Item).Name("Item")
.Height(400).HeaderTemplate("<div class=\"dropdown-header k-widget k-header\"><span>Codice </span><span>Descrizione</span></div>").Template("<h3>#: data.Item #</h3><p>#: data.Description #</p>")//.ValueTemplate("<span>#: data.Item#</span>")
.Placeholder("Scegli un articolo")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetItem", "Ordini")
.Data("artForn");
}).ServerFiltering(true);
})
.Events(e =>
{
e.Change("change");
})
.AutoBind(false)
.Filter(FilterType.Contains)
.DataValueField("Item")
.DataTextField("Item")
)
@Html.ValidationMessageFor(model => model.Item)
</div>
<div id="ldesc"class="col-md-offset-4 col-md-8">
@Html.Label("Descrizione Articolo")
</div>
<div class="col-md-offset-4 col-md-8">
@(Html.Kendo().EditorFor(model=>model.Description)
.Name("Description").Tools(tools => tools
.ViewHtml()
).Value(@<text><p>
Read <a href="">more details</a>
</p>
</text>)
)
@Html.ValidationMessageFor(model => model.Description)
</div>
<div id="lum" class="col-md-offset-4 col-md-4">
@Html.Label("UM")
</div>
<div class="col-md-offset-4 col-md-4">
@Html.Kendo().DropDownListFor(model => model.BaseUoM).Name("BaseUoM").DataTextField("BaseUoM").DataValueField("BaseUoM").DataSource(source =>
{
source.Read(read =>
{
read.Action("GetUom", "Ordini")
.Data("filterUnitValue");
}).ServerFiltering(true);
}).Enable(false).AutoBind(false).CascadeFrom("Item")
@Html.ValidationMessageFor(model => model.BaseUoM)
</div>
<div id="lpconf" class="col-md-offset-4 col-md-10">
@Html.Label("Pezzi per confezione")
</div>
<div class="col-md-offset-4 col-md-10">
@Html.Kendo().DropDownListFor(model => model.PezziConf).Name("PezziConf").DataTextField("MinimumSaleQty").DataValueField("MinimumSaleQty").DataSource(source =>
{
source.Read(read =>
{
read.Action("GetPezziConf", "Ordini")
.Data("filterDueValue");
}).ServerFiltering(true);
}).Enable(false).AutoBind(false).CascadeFrom("Item")
@Html.ValidationMessageFor(model => model.PezziConf)
</div>
<div id="lqty" class="col-md-offset-4 col-md-10">
@Html.Label("Quantità ")
</div>
<div class="col-md-offset-4 col-md-10">
@Html.Kendo().NumericTextBoxFor(model => model.Qty).Decimals(2).Min(1).Max(99999.0).Value(1).Name("Qty")
@Html.ValidationMessageFor(model => model.Qty)
</div>
<div id="lpr" class="col-md-offset-4 col-md-10">
@Html.Label("Valore Unitario")
</div>
<div class="col-md-offset-4 col-md-10">
@Html.Kendo().DropDownListFor(model => model.UnitValue).DataTextField("UnitValue").Name("UnitValue").DataValueField("UnitValue").Events(events => events.Change("OrderDetailsEdit_Price_Change")).DataSource(source =>
{
source.Read(read =>
{
read.Action("GetUnitValue", "Ordini")
.Data("filterDueValue");
}).ServerFiltering(true);
}).Enable(false).AutoBind(false).CascadeFrom("Item")
@Html.ValidationMessageFor(model => model.UnitValue)
</div>
<div id="lsc" class="col-md-offset-4 col-md-10">
@Html.Label("Sconto")
</div>
<div class="col-md-offset-4 col-md-10">
@Html.Kendo().DropDownListFor(model => model.DiscountFormula).Name("DiscountFormula").DataTextField("DiscountFormula").DataValueField("DiscountFormula").DataSource(source =>
{
source.Read(read =>
{
read.Action("GetDF", "Ordini")
.Data("filterDueValue");
}).ServerFiltering(true);
}).Enable(false).AutoBind(false).CascadeFrom("Item")
</div>
<div id="lect" class="col-md-offset-4 col-md-10">
@Html.Label("EcoTassa")
</div>
<div class="col-md-offset-4 col-md-10">
@Html.Kendo().DropDownListFor(model => model.EcoTassa).Name("EcoTassa").Value("0").DataTextField("EcoTassa").DataValueField("EcoTassa").DataSource(source =>
{
source.Read(read =>
{
read.Action("GetEcoT", "Ordini")
.Data("filterDueValue");
}).ServerFiltering(true);
}).Enable(false).AutoBind(false).CascadeFrom("Item")
</div>
<div id="ltaxc" class="col-md-offset-4 col-md-10">
@Html.Label("Codice IVA")
</div>
<div class="col-md-offset-4 col-md-10">
@Html.Kendo().DropDownListFor(model => model.TaxCode).Name("TaxCode").DataTextField("TaxCode").DataValueField("TaxCode").DataSource(source =>
{
source.Read(read =>
{
read.Action("GetTaxCode", "Ordini")
.Data("filterUnitValue");
}).ServerFiltering(true);
}).Enable(false).AutoBind(false).CascadeFrom("Item")
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}