Hi,
I am trying to use kendo datepicker inside a grid using editor template but when a select a date from date picker, it doesn't bind that selected date value to the grid and value remains the same as it was earlier. So I am not able to update the value for a particular field using datepicker inside kendogrid.
Here is my code:
This is my View part:
@(Html.Kendo().Grid<PricePoint.Model.PriceSheet.PriceSheetHeader>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.stateid).Title("[[[State]]]").Width(50);
columns.Bound(p => p.distributor).Title("[[[Distributor]]]").Width(100);
columns.Bound(p => p.whare_house_code).Title("[[[Warehouse Code]]]").Width(120);
columns.Bound(p => p.brand).Title("[[[Brand]]]").Width(100);
columns.Bound(p => p.item).Title("[[[Item]]]").Width(100);
columns.Bound(p => p.fob).Title("[[[FOB]]]").Width(50).Format("{0:" + ViewBag.GetAllFormat.currencyFormat + "}");
columns.Bound(p => p.pricesheetform_version_no).Title("[[[Form Version]]]").Width(50);
columns.Bound(p => p.startdate).Title("[[[Start Date]]]").Width(50).Format("{0:dd/MM/yyyy}").EditorTemplateName("DateTime");
columns.Bound(p => p.enddate).Title("[[[End Date]]]").Width(200).Format("{0:dd/MM/yyyy}").Width(170).EditorTemplateName("EditrTemp");
columns.Bound(p => p.createdate).Title("[[[Created On]]]").Width(50).Format("{0:" + ViewBag.GetAllFormat.dateFormat + "}");
columns.Bound(p => p.modifydate).Title("[[[Modified On]]]").Width(50).Format("{0:" + ViewBag.GetAllFormat.dateFormat + "}");
columns.Bound(p => p.createby).Title("[[[Created By]]]").Width(50);
columns.Bound(p => p.modifyby).Title("[[[Modified By]]]").Width(50);
}).ToolBar(toolBar =>
{
toolBar.Save();
toolBar.Custom().Text("[[[Export To Excel]]]").HtmlAttributes(new { onclick = "javascript:ExportToExcel(event);", @class = "k-button" });
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Events(ev=>ev.DataBound("db"))
.Pageable(pageable =>
{
pageable.Refresh(true);
pageable.PageSizes(new int[] { 25, 50, 100, 200 });
pageable.Messages(messages => messages.Empty("[[[No form found]]]"));
})
.Sortable()
.Filterable(f => f.Operators(o => o.ForString(fs =>
{ fs.Clear().Contains("Contains");
fs.DoesNotContain("Does not contain");
fs.IsEqualTo("Equal to");
fs.IsNotEqualTo("Not equal to");
fs.StartsWith("Starts with");
fs.EndsWith("Ends with"); })))
.HtmlAttributes(new { style = "min-width: 1250px;" })
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false) // paging, sorting, filtering and grouping will be applied client-side
.Batch(true)
.Model(model =>
{
model.Id(p => p.pricesheetid);
})
.Read("GetAllModifyPriceSheetAjax", "PriceSheet")
.Update(update => update.Action("UpdatePriceEntry", "PriceSheet"))
.PageSize(25)
.Events(events => events.Error("error_handler"))
)
)
This is the EditrTemp i am using for datepicker:
@model DateTime?
@(Html.Kendo().DatePickerFor
(m => m)
.Name("EditrTemp")
.Format("dd/MM/yyyy")
)
I am trying to use kendo datepicker inside a grid using editor template but when a select a date from date picker, it doesn't bind that selected date value to the grid and value remains the same as it was earlier. So I am not able to update the value for a particular field using datepicker inside kendogrid.
Here is my code:
This is my View part:
@(Html.Kendo().Grid<PricePoint.Model.PriceSheet.PriceSheetHeader>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.stateid).Title("[[[State]]]").Width(50);
columns.Bound(p => p.distributor).Title("[[[Distributor]]]").Width(100);
columns.Bound(p => p.whare_house_code).Title("[[[Warehouse Code]]]").Width(120);
columns.Bound(p => p.brand).Title("[[[Brand]]]").Width(100);
columns.Bound(p => p.item).Title("[[[Item]]]").Width(100);
columns.Bound(p => p.fob).Title("[[[FOB]]]").Width(50).Format("{0:" + ViewBag.GetAllFormat.currencyFormat + "}");
columns.Bound(p => p.pricesheetform_version_no).Title("[[[Form Version]]]").Width(50);
columns.Bound(p => p.startdate).Title("[[[Start Date]]]").Width(50).Format("{0:dd/MM/yyyy}").EditorTemplateName("DateTime");
columns.Bound(p => p.enddate).Title("[[[End Date]]]").Width(200).Format("{0:dd/MM/yyyy}").Width(170).EditorTemplateName("EditrTemp");
columns.Bound(p => p.createdate).Title("[[[Created On]]]").Width(50).Format("{0:" + ViewBag.GetAllFormat.dateFormat + "}");
columns.Bound(p => p.modifydate).Title("[[[Modified On]]]").Width(50).Format("{0:" + ViewBag.GetAllFormat.dateFormat + "}");
columns.Bound(p => p.createby).Title("[[[Created By]]]").Width(50);
columns.Bound(p => p.modifyby).Title("[[[Modified By]]]").Width(50);
}).ToolBar(toolBar =>
{
toolBar.Save();
toolBar.Custom().Text("[[[Export To Excel]]]").HtmlAttributes(new { onclick = "javascript:ExportToExcel(event);", @class = "k-button" });
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Events(ev=>ev.DataBound("db"))
.Pageable(pageable =>
{
pageable.Refresh(true);
pageable.PageSizes(new int[] { 25, 50, 100, 200 });
pageable.Messages(messages => messages.Empty("[[[No form found]]]"));
})
.Sortable()
.Filterable(f => f.Operators(o => o.ForString(fs =>
{ fs.Clear().Contains("Contains");
fs.DoesNotContain("Does not contain");
fs.IsEqualTo("Equal to");
fs.IsNotEqualTo("Not equal to");
fs.StartsWith("Starts with");
fs.EndsWith("Ends with"); })))
.HtmlAttributes(new { style = "min-width: 1250px;" })
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false) // paging, sorting, filtering and grouping will be applied client-side
.Batch(true)
.Model(model =>
{
model.Id(p => p.pricesheetid);
})
.Read("GetAllModifyPriceSheetAjax", "PriceSheet")
.Update(update => update.Action("UpdatePriceEntry", "PriceSheet"))
.PageSize(25)
.Events(events => events.Error("error_handler"))
)
)
This is the EditrTemp i am using for datepicker:
@model DateTime?
@(Html.Kendo().DatePickerFor
(m => m)
.Name("EditrTemp")
.Format("dd/MM/yyyy")
)