We are using Kendo UI grid to import data from one grid to another grid, For that purpose we need to input some data to the kendo grid in the ADD Mode, Unfortunately Kendo grid input only available in the edit mode,I'm using ClientTemplate to input the data,but that is not support exactly,because kendo feature overridden....Please give me a solution to input data...
@(Html.Kendo().Grid<Portal.Presentation.Web.BoundedContext.TNA.Template.MVC.Areas.Razor.Models.TaskPoupModel>()
.Name("importtaskgrid")
.AutoBind(true)
.HtmlAttributes(new {style = "border: 0;"})
.Columns(c =>
{
c.Bound(x => x.TaskId).Hidden();
c.ForeignKey(p => p.TaskGroupId, (System.Collections.IEnumerable) ViewData["TaskGroups"], "Key", "Value").Title("TASK GROUP").Sortable(true);
c.Bound(x => x.TaskName).Title("TASK NAME").Sortable(true);
c.Bound(x => x.LeadTime).Title("LEAD TIME").Sortable(false).
ClientTemplate("<input type='text' name='importtaskgrid[#= ImportPopupHandler.index(data)#].LeadTime' value='#= LeadTime #' validateFor='number'/>");
c.ForeignKey(p => p.UserId, (System.Collections.IEnumerable) ViewData["Users"], "Key", "Value").Title("TASK OWNER").Sortable(true);
c.Bound(x => x.IsImport).ClientTemplate("<input type='checkbox' #= IsImport ? checked='checked' : '' # ></input>").Title("PICK TO IMPORT").Width(100).Sortable(false);
})
.Sortable()
.Editable(x => x.Mode(GridEditMode.InCell))
.DataSource(dataSource => dataSource
.Ajax().ServerOperation(true)
.Sort(sort => sort.Add(p => p.TaskName).Descending())
.PageSize(20)
.Events(events => events.Error("error_handler"))
.Model(model =>
{
model.Id(p => p.TaskId);
model.Field(p => p.TaskGroupId).Editable(false);
model.Field(p => p.TaskName).Editable(false);
model.Field(p => p.LeadTime).DefaultValue(0);
model.Field(p => p.UserId).DefaultValue(0);
})
.Read(read => read.Action("OnPopupTaskRead", "Tna").Data("ImportPopupHandler.getAdditionalData").Type(HttpVerbs.Get)
))
.Scrollable()
)
@(Html.Kendo().Grid<Portal.Presentation.Web.BoundedContext.TNA.Template.MVC.Areas.Razor.Models.TaskPoupModel>()
.Name("importtaskgrid")
.AutoBind(true)
.HtmlAttributes(new {style = "border: 0;"})
.Columns(c =>
{
c.Bound(x => x.TaskId).Hidden();
c.ForeignKey(p => p.TaskGroupId, (System.Collections.IEnumerable) ViewData["TaskGroups"], "Key", "Value").Title("TASK GROUP").Sortable(true);
c.Bound(x => x.TaskName).Title("TASK NAME").Sortable(true);
c.Bound(x => x.LeadTime).Title("LEAD TIME").Sortable(false).
ClientTemplate("<input type='text' name='importtaskgrid[#= ImportPopupHandler.index(data)#].LeadTime' value='#= LeadTime #' validateFor='number'/>");
c.ForeignKey(p => p.UserId, (System.Collections.IEnumerable) ViewData["Users"], "Key", "Value").Title("TASK OWNER").Sortable(true);
c.Bound(x => x.IsImport).ClientTemplate("<input type='checkbox' #= IsImport ? checked='checked' : '' # ></input>").Title("PICK TO IMPORT").Width(100).Sortable(false);
})
.Sortable()
.Editable(x => x.Mode(GridEditMode.InCell))
.DataSource(dataSource => dataSource
.Ajax().ServerOperation(true)
.Sort(sort => sort.Add(p => p.TaskName).Descending())
.PageSize(20)
.Events(events => events.Error("error_handler"))
.Model(model =>
{
model.Id(p => p.TaskId);
model.Field(p => p.TaskGroupId).Editable(false);
model.Field(p => p.TaskName).Editable(false);
model.Field(p => p.LeadTime).DefaultValue(0);
model.Field(p => p.UserId).DefaultValue(0);
})
.Read(read => read.Action("OnPopupTaskRead", "Tna").Data("ImportPopupHandler.getAdditionalData").Type(HttpVerbs.Get)
))
.Scrollable()
)