简体   繁体   English

如何在asp.net MVC 5中使用老版本的Telerik.Web.Mvc?

[英]How to use Telerik.Web.Mvc an older version with asp.net MVC 5?

Currently I am using Telerik.Web.Mvc.dll with asp.net MVC 2. I need to migrate my application to asp.net MVC 5. Is there any way I could achieve this ? 当前,我将Telerik.Web.Mvc.dll与asp.net MVC 2一起使用。我需要将应用程序迁移到asp.net MVC5。有什么办法可以实现? Thanks in advance. 提前致谢。

<% Html.Telerik().Grid(Model.Data).TableHtmlAttributes(new {@class="table table-hover table-responsive table-striped cont_TableCustom freeze_Table "})
   .Name("Details")
   .DataKeys(datakeys =>
   {
       datakeys.Add(p => p.ID).RouteKey("ID");
   })
   .DataBinding(databinding => databinding
   .Server().Delete("Delete", "Home"))
   .Columns(columns =>
    {
       columns.Bound(p => p.Name).Title("Name");
       columns.Bound(p => p.No).Title(" No");
    }).Pageable(Pager => Pager.PageSize(PageSize).Enabled((Model.Data.Count() > PageSize) ? true : false)).Sortable().Render();
%>

I just need to use this grid with MVC 5. 我只需要将此网格与MVC 5一起使用。

Yes, as long as you pass the same model from the controller to the view, it should work. 是的,只要您将相同的模型从控制器传递到视图,它就应该起作用。 All you have to do is change the syntax from <% %> to just @Html.Telerik().RestOfTheCode.... Have a look at the Razor syntax at: https://www.w3schools.com/asp/razor_syntax.asp 所有你需要做的就是改变从<%%>语法只是@ Html.Telerik()RestOfTheCode ....看一看剃刀语法为: https://www.w3schools.com/asp/razor_syntax的.asp

PS: Also declare the model type at the top of the page with @model TypeOfYourModel PS:还要在页面顶部使用@model TypeOfYourModel声明模型类型

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM