在已有項目中引入FineUIMvc
阿新 • • 發佈:2017-10-19
style table 鏈接 source lob 支持 mes out render
FineUIMvc簡介
FineUIMvc 是基於 jQuery 的專業 ASP.NET MVC 控件庫,其前身是基於 WebForms 的開源控件庫 FineUI(歷時9年120多個版本)。FineUIMvc(基礎版)包含開源版的全部功能,支持 30 種內置主題和 FontAwesome 圖標,支持消息對話框和單元格編輯表格,功能強大,最重要的是完全免費。
【空項目+快速入門+在線示例源代碼+服務端參考手冊+客戶端參考手冊】下載地址:
鏈接:http://pan.baidu.com/s/1o8pWqQQ 密碼:uhxl
1、將項目改成經典模式,Fineui只能運行於經典模式
2、下載空項目,將res文件夾內容拷入
3、修改Web.config
空項目已經配置好了Web.config文件,主要是兩個地方的改動:
<configSections> <section name="FineUIMvc" type="FineUIMvc.ConfigSection, FineUIMvc" requirePermission="false" /> </configSections> <FineUIMvc DebugMode="true" Theme="Cupertino" />
另外一處配置HTTP處理器:
<system.web> <httpModules> <add name="FineUIMvcScriptModule" type="FineUIMvc.ScriptModule, FineUIMvc"/> </httpModules> <httpHandlers> <add verb="GET" path="res.axd" type="FineUIMvc.ResourceHandler, FineUIMvc"/> </httpHandlers> </system.web>
4、添加全局模型綁定器
在Global.asax中,添加全部模型綁定器:
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); ModelBinders.Binders.Add(typeof(JArray), new JArrayModelBinder()); ModelBinders.Binders.Add(typeof(JObject), new JObjectModelBinder()); }
5、布局視圖
布局視圖類似於WebForms的母版頁,位於Views/Home/Shared/_Layout.cshtml,我們先看下其中的代碼:
@{ var F = Html.F(); } <!DOCTYPE html> <html> <head> <title>@ViewBag.Title - FineUIMvc 空項目</title> @F.RenderCss() <link href="~/res/css/common.css" rel="stylesheet" type="text/css" /> @RenderSection("head", false) </head> <body> @Html.AntiForgeryToken() @F.PageManager @RenderSection("body", true) @F.RenderScript() @RenderSection("script", false) </body> </html>
6、記得把Views下Web.config拷貝過來
<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="項目名稱" /> <add namespace="FineUIMvc" /> </namespaces> </pages>
7、引入FineuiMVC.dll
在已有項目中引入FineUIMvc