I'm using Kendo UI Grid to populate list of data and when i click on particular row i need to redirect to another view page of that particular row. but i have a delete command for that particular row. When i try to delete particular row it redirect to another page.i don't need any redirection after deletion. so the possible solution is i want to deselect only the command column when i select a particular row. Both i need row selection but no need command column selection..Please give a solution for this...
@(Html.Kendo().Grid<Portal.Presentation.Web.BoundedContext.TNA.Template.MVC.Areas.Razor.Models.TemplateModel>()
.Name("grid_Template_Freeze")
.AutoBind(true)
.Groupable()
.Sortable()
.HtmlAttributes(new { style = "border: 0;" })
.Scrollable(a => a.Height("auto"))
.Selectable(sel => { sel.Mode(GridSelectionMode.Single); sel.Type(GridSelectionType.Row); sel.Enabled(true);
})
.Columns(c =>
{
c.Bound(p => p.TemplateId).Hidden();
c.Bound(p => p.TemplateName).Title(" ").Title("TEMPLATE NAME");
c.ForeignKey(p => p.ProductTypeId, (System.Collections.IEnumerable) ViewData["ProductTypes"], "Key", "Value").Title("PRODUCT TYPE");
c.ForeignKey(p => p.OwnershipId, (System.Collections.IEnumerable)ViewData["UserTypes"], "Key", "Value").Title("OWNERSHIP");
c.Bound(p => p.CreatedOn).Title("CREATED DATE").Format("{0:dd/MM/yyyy hh:mm}");
c.Bound(p => p.UpdatedOn).Title("LAST MODIFIED DATE").Format("{0:dd/MM/yyyy hh:mm}");
c.ForeignKey(p => p.StatusId, (System.Collections.IEnumerable)ViewData["StatusTypes"], "Key", "Value").Title("STATUS");
c.Command(command => command.Destroy()).Width(80);
})
.Events(evt => evt.Change("TemplateTaskHandler.onChange"))
.DataSource(dataSource => dataSource
.Ajax()
.Sort(sort => sort.Add(p => p.TemplateName).Descending())
.Model(model =>
{
model.Id(p => p.TemplateId);
model.Field(p => p.TemplateId);
})
.Events(events => events.Error("error_handler"))
.PageSize(20).ServerOperation(false)
.Destroy(destroy => destroy.Action("OnTempaleDelete", "List"))
.Read(read => read.Action("OnTempaleRead", "List"))
).Pageable(x => { x.Enabled(true); x.PreviousNext(true); x.PageSizes(true); x.Info(true); x.Input(true); x.Numeric(false); x.Refresh(true); }))
var TemplateTaskHandler = {
onChange: function (e) {
var grid = $("#grid_Template_Freeze").data("kendoGrid");
var item = grid.dataSource.data()[grid.select().index()];
location.href = "@Model.ResolveRouteUrl(Portal.Presentation.Web.BoundedContext.TNA.Template.MVC.Areas.Razor.Models.TnaModelTypes.Update)" + "&tmpl=" + item.TemplateId;
}
};
}
@(Html.Kendo().Grid<Portal.Presentation.Web.BoundedContext.TNA.Template.MVC.Areas.Razor.Models.TemplateModel>()
.Name("grid_Template_Freeze")
.AutoBind(true)
.Groupable()
.Sortable()
.HtmlAttributes(new { style = "border: 0;" })
.Scrollable(a => a.Height("auto"))
.Selectable(sel => { sel.Mode(GridSelectionMode.Single); sel.Type(GridSelectionType.Row); sel.Enabled(true);
})
.Columns(c =>
{
c.Bound(p => p.TemplateId).Hidden();
c.Bound(p => p.TemplateName).Title(" ").Title("TEMPLATE NAME");
c.ForeignKey(p => p.ProductTypeId, (System.Collections.IEnumerable) ViewData["ProductTypes"], "Key", "Value").Title("PRODUCT TYPE");
c.ForeignKey(p => p.OwnershipId, (System.Collections.IEnumerable)ViewData["UserTypes"], "Key", "Value").Title("OWNERSHIP");
c.Bound(p => p.CreatedOn).Title("CREATED DATE").Format("{0:dd/MM/yyyy hh:mm}");
c.Bound(p => p.UpdatedOn).Title("LAST MODIFIED DATE").Format("{0:dd/MM/yyyy hh:mm}");
c.ForeignKey(p => p.StatusId, (System.Collections.IEnumerable)ViewData["StatusTypes"], "Key", "Value").Title("STATUS");
c.Command(command => command.Destroy()).Width(80);
})
.Events(evt => evt.Change("TemplateTaskHandler.onChange"))
.DataSource(dataSource => dataSource
.Ajax()
.Sort(sort => sort.Add(p => p.TemplateName).Descending())
.Model(model =>
{
model.Id(p => p.TemplateId);
model.Field(p => p.TemplateId);
})
.Events(events => events.Error("error_handler"))
.PageSize(20).ServerOperation(false)
.Destroy(destroy => destroy.Action("OnTempaleDelete", "List"))
.Read(read => read.Action("OnTempaleRead", "List"))
).Pageable(x => { x.Enabled(true); x.PreviousNext(true); x.PageSizes(true); x.Info(true); x.Input(true); x.Numeric(false); x.Refresh(true); }))
var TemplateTaskHandler = {
onChange: function (e) {
var grid = $("#grid_Template_Freeze").data("kendoGrid");
var item = grid.dataSource.data()[grid.select().index()];
location.href = "@Model.ResolveRouteUrl(Portal.Presentation.Web.BoundedContext.TNA.Template.MVC.Areas.Razor.Models.TnaModelTypes.Update)" + "&tmpl=" + item.TemplateId;
}
};
}