Edi Wang

.NET and Azure Developer

MVC

Kendo UI for ASP.NET MVC 的一些使用经验

最近的项目里用到了Kendo UI。这货很好很强大,但可惜官方文档组织的并不是很好,有很多配置非常坑,需要自己去发掘。 一、版本 首先,是版本的区别。简单的来说,免费版的Kendo UI是不包含DataViz组件的,即没有图表功能,并且也没有服务端的Helper,比如MVC的wapper,所以,免费版只有js和css,不会给你dll的。 收费版,比如for MVC的这个版本,除了包含dataviz以外,还包含预先定义好的mvc wapper,所以你需要引用dll才能使用kendo的html helper。这些Helper的功能仅仅是生成对应的JS,对于熟悉C#的程序员来说,图个方便而已。不过不得不承认,这些helper的设计是一流的,使用lambda表达式来配置参数感觉非常棒。 总结一下,如果你的团队前端程序员非常碉,你可以使用免费版,但不包含图表组件。如果你是像我一样的屌丝ASP. …
ASP.NET MVC Kendo UI

Store and Read Images via SQL Server in ASP.NET MVC 3

First of all, I don't recommend storing images in the database, especially in a web project. Because file systems can provide static file access and get many benefits such as performance. Storing images in the database has certain limits. But if you must store images into SQL Server, here's how to do it.  SQL Image files are in fact, binary data. SQL Server provides us the image type for …
ASP.NET MVC SQL Server

Model Validation in ASP.NET MVC3

ASP.NET The model in MVC3 is self-validating, which is via the System.ComponentModel.DataAnnotations namespace from NET4. All we need to do is add the corresponding Attributes to the attributes of the Model class, and then the MVC3 framework will do the validation for us. I will use the login that comes with the MVC3 project template as an example to explain the validation of the model. 1. Enable Client Validation Client-side validation is mainly to improve the user experience, and the validation is completed without the web page being brushed back. The first step is to enable client validation in web.config, which is already available in the template project that comes with MVC3
ASP.NET MVC

ASP.NET MVC3和传统WebForm共存时,Chart控件无法显示的解决办法

最近把博客的前台改到了MVC3上去,后台还是WebForm做的。一直有个小bug,今天才刚刚解决。后台页面里有个地方用了ASP.NET 4自带的那个Chart图表控件。原来没用MVC的时候是可以显示的。换了MVC之后,WebForm的代码没有改过,其他都好用,就这个Chart爆了。具体表现为,网页没有报错,就Chart的部分显示不出来。今天检查了一下,并最终解决了这个问题。 首先我在firebug里发现,Chart控件生成的图片是来自一个handler的,但加载失败了: 根据最近玩MVC被坑的经验,可能是URL路由引起的。我去后台日志查看了一下,果然是这样的: 解决办法很简单,在Global.asax里写一条忽略URL路由的规则: routes.IgnoreRoute("Console/Dashboard/ChartImg.axd");   但我很奇怪,MVC3默认已经在Global. …
ASP.NET Chart MVC WebForms