Telerik UI for ASP.Net有多个Nuget包,如Kendo UI for ASP.Net MVC、Kendo UI Professional、Kendo UI Core等。它们的区别在于功能的不同以及授权方式的不同。
以下是使用Kendo UI Core的示例:
- 从Nuget安装Kendo UI Core:
Install-Package Kendo.Mvc
- 在头文件中引入Kendo UI Core CSS和JavaScript文件:
- 在View中使用Kendo UI Core控件:
@(Html.Kendo().Grid()
.Name("grid")
.Columns(columns =>
{
columns.Bound(e => e.FirstName);
columns.Bound(e => e.LastName);
columns.Bound(e => e.Title);
columns.Bound(e => e.Country);
})
.Pageable()
.Sortable()
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Index", "Employee"))
)
)
以上示例演示了如何使用Kendo UI Core的Grid控件。需要注意的是,Kendo UI Core是非商业用途免费的,如果是商业用途,需要使用付费版本如Kendo UI Professional。