Asp.Net MVC4.0入门指南(10):第三方控件Studio for ASP.NET Wijmo MVC4 工具应用

49 篇文章 0 订阅

ComponentOne Studio for ASP.NET Wijmo最新版本2013V1支持MVC4,其中包括:

  • 新增 MVC 4 工程模板 (C# & VB) 开箱即用的MVC 4 工程模板基于Microsoft内置模板创建,我们仅优化了标记和CSS样式为 Wijmo风格,熟悉的模板布局和界面风格,无疑将缩短您的学习过程、节省开发时间及提高开发效率。
  • 新增国际化主题(Metro)
    • MVC4 模板自动增强Wijmo MVC Scaffolding模板,将会为您应用程序中的增删改查(CRUD)操作生成默认的模板文件,这些生成的文件为您的工程构建了起始的工程文件目录结构,当然你也可以修改它,Scaffolding模板的优美之处在于生成后您可以按照您的意愿来扩展它。
    • Wijmo-增强编辑器模板 该模板使您可以通过日期选择器、数值输入框和滑动条快速的定制应用。您甚至可以添加其他自定义的模板。

 

 

开始使用

使用ComponentOne Studio for ASP.NET Wijmo制作MVC4应用程序,首先要做的是安装Studio for ASP.NET Wijmo

测试环境 VS2012、MVC4、Framework4.5、IE10、Studio for ASP.NET Wijmo2013V1

 

文件-新建项目

在安装了Studio for ASP.NET Wijmo2013V1 之后,在 VS2012 中选择新建项目。在 Web 选项卡中,您可以发现Studio for ASP.NET Wijmo2013V1。

clip_image002

好了,现在让我们运行程序看看初始效果。您可能对这个界面很熟悉。因为Wijmo MVC 4 工程模板是基于Microsoft内置模板创建。我们仅优化了标记和CSS样式为 Wijmo风格。

clip_image004

 

添加模型

下面,让我们使用Wijmo MVC Scaffolding模板创建一个简易的“ToDoList”。首先我们来添加模型。需要添加以下代码:

?
namespace MVC4Wijmo.Models
{
     public class ToDoList
     {
         [Editable( false )]
         public int Id { get ; set ; }
 
         [Required]
         public string Title { get ; set ; }
 
         [Display(Name = "Date Created" )]
         public DateTime? CreatedAt { get ; set ; }
 
         [Range(0, 5), UIHint( "IntSlider" )]
         public int Priority { get ; set ; }
 
         [Range(0, 1000000)]
         public decimal Cost { get ; set ; }
 
         [DataType(DataType.MultilineText)]
         public string Summary { get ; set ; }
 
         public bool Done { get ; set ; }
 
         [Display(Name = "Date Completed" )]
         public DateTime? DoneAt { get ; set ; }
 
         public ICollection<TahDoItem> TahDoItems { get ; set ; }
 
     }
 
     public class TahDoItem
     {
         [Editable( false )]
         public int Id { get ; set ; }
 
         [Required]
         public string Title { get ; set ; }
 
         [Display(Name = "Date Created" )]
         public DateTime? CreatedAt { get ; set ; }
 
         [Range(0, 5), UIHint( "IntSlider" )]
         public int Priority { get ; set ; }
 
         [DataType(DataType.MultilineText)]
         public string Note { get ; set ; }
 
         public int ToDoListId { get ; set ; }
 
         public ToDoList ToDoList { get ; set ; }
 
         public bool Done { get ; set ; }
 
         [Display(Name = "Date Completed" )]
         public DateTime? DoneAt { get ; set ; }
     }
}

 

创建控制器和视图

在添加控制器和视图之前,编译项目。这将使Scaffolding模板识别新增的模型。现在,邮件点击Controllers文件夹,选择“添加控制器”,选择一下选项点击“添加”。

clip_image006

Scaffolding将会自动生成控制器和增删改查应用程序所需要的所有视图。最大的亮点是这些生成的文件为您的工程构建了起始的工程文件目录结构,当然你也可以修改它,Scaffolding模板的优美之处在于生成后您可以按照您的意愿来扩展它。

 

运行

仅仅通过以上步骤,我们就实现了简易的ToDoList。切换到ToDoList页面,应用程序会给模型创建数据源,首先展示给我们的是一张空表格。我们可以通过“创建新计划”按钮添加计划。

clip_image008

在创建视图中您会发现展现在眼前的是标准的EditorFor Helpers。然而我们已经在工程中添加了自定义编辑模板。所以如果使用日期或数值等类型时,Scaffolding模板会自动生成编辑器。下面自定义编辑器视图截图:

clip_image010

现在我们就完成了具有增删改查功能的MVC4应用程序。这些生成的文件为您的工程构建了起始的工程文件目录结构,当然你也可以修改它,Scaffolding模板的优美之处在于生成后您可以按照您的意愿来扩展它。

 

Demo源码下载TahDoMvc4.zip

工具下载链接:Studio for ASP.NET Wijmo

-----------------------------------------------------------------------------------------------------------------------------------------------

译者注:

本系列共9篇文章,翻译自Asp.Net MVC4 官方教程,由于本系列文章言简意赅,篇幅适中,从一个示例开始讲解,全文最终完成了一个管理影片的小系统,非常适合新手入门Asp.Net MVC4,并由此开始开发工作。9篇文章为:

1. Asp.Net MVC4.0 入门介绍

· 原文地址:http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/intro-to-aspnet-mvc-4

2. 添加一个控制器

· 原文地址:http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-controller

3. 添加一个视图

· 原文地址:http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-view

4. 添加一个模型

· 原文地址:http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-model

5. 从控制器访问数据模型

· 原文地址:http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/accessing-your-models-data-from-a-controller

6. 验证编辑方法和编辑视图

· 原文地址:http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/examining-the-edit-methods-and-edit-view

7. 给电影表和模型添加新字段

· 原文地址:http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-new-field-to-the-movie-model-and-table

8. 给数据模型添加校验器

· 原文地址:http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-validation-to-the-model

9. 查询详细信息和删除记录

· 原文地址:http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/examining-the-details-and-delete-methods

同系列文章

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ComponentOne Studio for ASP.NET Wijmo 2013 v1 2/5 共五个压缩文件,请全部下载后解压 Part of: Ultimate | Enterprise 40+ styled, supercharged, and easy-to-use controls built on Web standards including AJAX, CSS, HTML5, and jQuery. One Technology for All ASP.NET Development One Technology for All ASP.NET Development Take on any project with a single technology that provides everything from pure client-side development to robust server-side development. Empower your team with the tools they need to build engaging Web applications. ComponentOne provides the ultimate UI controls from WebForms to MVC powered by the core client technology: Wijmo. Learn more about the ComponentOne Web Stack. The Most Innovative Technology The Most Innovative Technology Your web applications will perform faster, run smoother, and be more engaging than even before. Built with HTML5, jQuery, CSS3, and SVG, Studio for ASP.NET Wijmo controls make your applications suitable for Today's Web. Effortless Application-wide Theming Effortless Application-wide Theming Easily develop a consistent look and feel across your entire application. Start by using the six professionally designed themes pre-packaged in ComponentOne’s ASP.NET Wijmo controls. Optionally, choose from over 30 themes from the jQuery UI project or use ThemeRoller from jQuery UI to create your own custom theme. Learn more about the Studio for ASP.NET Wijmo rich theming architecture or launch the ASP.NET Theme Explorer to see for yourself. Full Cross-browser Compatibility Full Cross-browser Compatibility Ensure your UI works in every browser and every device without worrying about compatibility issues. Create interactive charts that render just as well in IE6 as they do on an iPad. Studio for ASP.NET Wijmo controls support these popular browsers: IE6+, Firefox 3+, Safari 3+, and Chrome. Unmatched Performance In modern Web development, client-side download and performance are critical. With those key factors in mind, we created a new high-performance client-side framework (Wijmo). Using Studio for ASP.NET Wijmo controls you can choose whether features are executed on the client or server. Easily develop responsive applications that minimize Postbacks to the server, and experience unmatched performance with quick client-side download and scripting optimization on the client. Built-in Web Standards and Accessibility Built-in Web Standards and Accessibility Web Standards like semantic markup, progressive enhancement, and CSS styling are important elements of robust web development. Just the same, accessibility enhancements like Section 508 compliance and ARIA support are vital. Be certain your controls use Web Standards and meet strict accessibility guidelines with Studio for ASP.NET Wijmo. Premium Support Premium Support You don't have to worry about questions slowing you down. Get fast and professional help while using our tools with Premium support. From our 24-hour support response guarantee to our knowledge-rich online community, enjoy unmatched support. Complete Documentation Get started quickly by referencing in-depth documentation and samples with full source code. Searching for something specific? Take a look at the Studio for ASP.NET Wijmo documentation, which includes quick starts, tutorials, syntax, and more. Or, explore the controls by playing with the Studio for ASP.NET Wijmo demos.
ASP.NET MVC 5 框架揭秘》以一个模拟ASP.NET MVC内部运行机制的“迷你版MVC框架”作为开篇,其目的在于将ASP.NET MVC真实架构的“全景”勾勒出来。接下来本书以请求消息在ASP.NET MVC框架内部的流向为主线将相关的知识点串连起来,力求将”黑盒式”的消息处理管道清晰透明地展示在读者面前。相信精读本书的读者一定能够将ASP.NET MVC从接收请求到响应回复的整个流程了然于胸,对包括路由、Controller的激活、Model元数据的解析、Action方法的选择与执行、参数的绑定与验证、过滤器的执行以及View的呈现等相关的机制具有深刻的理解。 本书以实例演示的方式介绍了很多与ASP.NET MVC相关的很好实践,同时还提供了一系列实用性的扩展,相信它们一定能够解决你在真实开发过程中遇到的很多问题。本书末章提供的案例不仅仅用于演示实践中的ASP.NET MVC,很多的架构设计方面的东西也包含其中。除此之外,本书在很多章节还从设计的角度对ASP.NET MVC的架构进行了深入分析,所以从某种意义上讲本书可以当成一本架构设计的书来读。 ASP.NET MVC 5 框架揭秘 目录 第1章 ASP.NET + MVC 第2章 路由 第3章 Controller的激活 第4章 Model元数据的解析 第5章 3个描述对象 第6章 Model的绑定(上篇) 第7章 Model的绑定(下篇) 第8章 Model的验证(上篇) 第9章 Model的验证(下篇) 第10章 Action方法的执行 第11章 View的呈现 第12章 过滤器 第13章 特性路由 第14章 案例实践

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值