Completed
Last Updated: 27 May 2021 07:34 by ADMIN
Mattias
Created on: 07 Feb 2013 11:02
Category: UI for ASP.NET MVC
Type: Feature Request
4
Enable or disable functions like Create, Edit and Destroy in Grid
Create:
Html.Kendo().Grid()
.ToolBar(commands => commands.Create(Model.EnableCreate))
where EnableCreate is a bool.

Next is Edit and Destroy:

columns.Command(commands =>
{               
     commands.Edit(item.EnableEdit);
     commands.Destroy(item.EnableDestroy);
})
where item is the dataitem of the row and EnableEdit and EnableDestroy is bool properties.
1 comment
ADMIN
Viktor Tachev
Posted on: 27 May 2021 07:34

Hi Mattias,

 

The visibility of the command buttons can be set conditionally based on a condition.

columns.Command(command => 
	{ 
		command.Edit().Visible("editVisible"); 
		command.Destroy(); 
	});

JavaScript:

function editVisible(dataItem) {
	return dataItem.ID == 5;
}

 

There is an option to make columns conditionally editable as well. The functionality is explained in detail in the KB article below:

https://docs.telerik.com/aspnet-mvc/html-helpers/data-management/grid/how-to/editing/conditionally-editable-columns

 

Regards,
Viktor Tachev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.