我如何使用剑道UI剃刀? [英] How can I use Kendo UI with Razor?

查看:256
本文介绍了我如何使用剑道UI剃刀?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经下载并使用剑道UI与剑道UI网格,但我的源$ C ​​$ C是非常复杂的,有以下几个原因:

I have downloaded and used Kendo UI with Kendo UI grids, but my source code was very complicated, for several reasons:


  1. 我砍死排序,使区分大小写的排序。

  1. I've hacked the sort to enable case insensitive sorting.

显示过滤器菜单,页面大小选择器,过滤器过滤器菜单功能菜单和DatePicker的时候我观察UI的bug;我已经解决了这些问题,丑陋的黑客。

I've observed UI bugs when displaying filter menu, page size selector, filter function menu and DatePicker in the filter menu; I've solved these problems with ugly hacks.

在客户端使用参数化的职位需要的时候我已经刷新网格。

On client-side I've refreshed the grid when needed using parameterized posts.

在服务器端我创建了处理网格的排序,过滤器,页面大小和分页状态的函数动态。

On server-side I have created a function which handled the sort, filter, page size and paging state of the grid dynamically.

不过,我的客户告诉我,我们需要一个简单的解决方案,一格页面应该在一小时内完成。我认为这是不切实际的与我目前的做法,除非我实现一个通用类来处理网格。这将使用LINQ,来处理表,字段,过滤器,排序,分页和页面大小是可能的。我知道这是肯定的,因为我的code不是被服务器端通用电网支持者,并在客户端的一个剑道UI电网工厂至今。然而,我的客户明确表示,我们并不需要实现这个类和原型,因为我们应该能够配置剑道UI简单。他告诉我(的previously不确定的细节),我们被允许返回的所有的从表和过滤器/行那种在客户端,所以分3和4会成为不必要。

However, my client told me that we need a "simple" solution, a grid page should be completed in an hour. I think this is unrealistic with my current approach unless I implement a generalized class to handle the grids. This would be possible using Linq, to handle the tables, fields, filters, sorts, paging and page size. I know this for sure, as my code is not so far from being a general-purpose grid supporter on server-side and a Kendo UI grid factory on client-side. However, my client clearly stated that we don't need to implement this class and prototype, because we should be able to configure Kendo UI simply. He told me (the previously unspecified detail) that we are allowed to return all the rows from a table and filter/sort that on client-side, so points 3 and 4 would become unneeded.

我一直在寻找的例子这里。我想有作为CSHTML的例子类似的东西。然而,在我下载Telerik的剑道UI我没有任何服务器端的内容,所以IDE中显示, Html.Kendo()。网格(模型)是不正确。误差如下:

I have been looking at the example here. I would like to have something similar as the example in cshtml. However, in my downloaded Telerik Kendo UI I don't have any server-side content, so the IDE is showing that Html.Kendo().Grid(Model) is incorrect. The error is as follows:

错误10'System.Web.Mvc.HtmlHelper'不包含'剑道'的定义,并没有扩展方法'剑道'接受的类型'System.Web.Mvc.HtmlHelper'的第一个参数可以发现(有你缺少using指令或程序集引用?)

Error 10 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'Kendo' and no extension method 'Kendo' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)

我使用ASP.NET MVC3使用LINQ。

I am using ASP.NET MVC3 with Linq.

我如何使用Telerik的剑道UI与ASP.NET剃刀在CSHTML文件中的链接描述的风格?这是免费的?如果没有,有多少费用是多少?我应该安装KendoUI.Mvc.VSPackage.vsix?

How can I use Telerik Kendo UI with ASP.NET Razor in the style described in the cshtml file in the link? Is this gratis? If no, how much is the cost? Should I install KendoUI.Mvc.VSPackage.vsix?

推荐答案

为了使用额外的助手,你需要用的Razor视图引擎注册。这是在的web.config 文件来完成,或使用.cshtml文件顶部 @using 语句。

In order to use additional helpers, you need to register them with Razor view engine. This is done in web.config file, or using @using statement on top of .cshtml file.

下面是一个例子我的的web.config

  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization"/>
        <add namespace="System.Web.Routing" />
        <add namespace="Kendo.Mvc.UI"/>
      </namespaces>
    </pages>
  </system.web.webPages.razor>

至于那张牌,这不是一个免费的软件。你可以看到在他们的网站。按他们的许可,它使用Telerik控制每个开发者都需要有一个许可证。许可证不是公司范围内或项目范围。

As far as licensing goes, this is not a freeware software. You can see licensing terms and prices on their website. As per their license, each developer which uses Telerik controls needs to have a license. License is not company wide, or project wide.

您不需要安装VSIX,但它可以让你的生活更轻松自动添加引用所需的程序集,并添加所需的条目web.config文件中。

You don't need to install vsix, but it could make your life easier by automatically adding references to required assemblies, and adding required entries to web.config files.

这篇关于我如何使用剑道UI剃刀?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆