随笔分类 - MVC
摘要:Views@using (Html.BeginForm("Create","img",FormMethod.Post, new { enctype = "multipart/form-data" })){ 图片: 链接地址: @Html.EditorFor(model => model.LinkUrl) 排序: @Html.EditorFor(model => model.Orderby) } JSfunction Check(str) { var img = ...
阅读全文
摘要:先去下载 mvcpagehttp://mvcpager.codeplex.com/releases/view/64098只需要一个MvcPager.dll文件即可 然后引用MvcPager.dll如需了解更多 可以访问http://www.webdiyer.com/Controls/MvcPager/DownloadsModels 引入命名空间new { ID =ViewBag.ID } 这里放分页前的地址栏查询参数,没有可以不写@using Webdiyer.WebControls.Mvc@using MVC.Models@using System.Data @Html.Pager(Mode
阅读全文
摘要:先去下载:http://code.google.com/p/kindeditor/downloads/list引用:LitJSON.dll文件@ViewBag.content 编辑的时候使用 @ViewBag.content//红色区域是后台获取name为TextArea1的值,如果不写 是获取不到的
阅读全文
摘要:遇到这个错误 在查询时 加上asNoTracking() 即可
阅读全文
摘要:配置ckfinder for asp.net 版本下载地址 http://cksource.com/ckfinder/downloadckeditor下载地址http://ckeditor.com/downloadconfig.ascxpublic override bool CheckAuthentication(){ return true; 设置为true} ckeditor config.js 新增config.filebrowserBrowseUrl = '/ckfinder/ckfinder.html'; //不要写成"~/ckfinder/...&quo
阅读全文
摘要:新增new { enctype = "multipart/form-data" } 这个必须要有@using (Html.BeginForm(Html.BeginForm("Create", "UserInfo", FormMethod.Post, new { enctype = "multipart/form-data" }))){图片@* *@} [HttpPost]public ActionResult Create(UserInfo userinfo){var file = Request.Files[0]
阅读全文
摘要:public ActionResult Index(int id = 1, string Keyword = ""){ViewBag.Page_Count = 10;ViewBag.CurrentPageSize = id;ViewBag.pageIndex = id;ViewBag.KeyName = Keyword;ViewBag.Keyword = "&&keyword=" + Keyword;List model = null ;if (Keyword.Length > 0){model = db.userinfo.Wher
阅读全文
摘要:EF中使用语句 或存储过程 查询1、无参数查询var model = db.Database.SqlQuery("select* from UserInfoes ").ToList();2、有参查询var model = db.Database.SqlQuery("select* from UserInfoes where id=@ID ",new SqlParameter("@ID",id)).ToList();3、结合linq查询var model = (from p in db.userinfo.SqlQuery("s
阅读全文
摘要:需要在库程序包管理器里依次执行以下命令:1.启用迁移功能:Enable-Migrations -ContextTypeName MvcMovie.Models.MovieDbContext2.建立初态:add-migration Initial3.自动比对差异生成迁移类:add-migration AddRatingMig4.将迁移应用到数据库:update-database依次执行 Enable-Migrations Add-Migration 1 (1是随便写的) Update-Database
阅读全文
摘要:错误 2280 类型“System.Web.Mvc.ModelClientValidationRule”同时存在于“C:\Program Files\Microsoft ASP.NET\ASP.NET Web Pages\v2.0\Assemblies\System.Web.WebPages.dll”和“C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll”中 D:\workspace\ecard26b\v 2.60\src\ecard.web\Global.asax.cs 310 37 E
阅读全文