摘要: 阅读全文
posted @ 2014-04-10 01:44 bl84757922 阅读(132) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Http;using System.Web.Mvc;using System.Web.Optimization;using System.Web.Routing;namespace S01Annotation{ // 注意: 有关启用 IIS6 或 IIS7 经典模式的说明, // 请访问 http://go.microsoft.com/?LinkId=9394801 public ... 阅读全文
posted @ 2014-04-10 01:40 bl84757922 阅读(292) 评论(0) 推荐(0) 编辑
摘要: @Ajax.ActionLink("获取服务器时间", "GetDate", "Cate", new AjaxOptions(){ HttpMethod = "post", UpdateTargetId = "dateSpan", InsertionMode = InsertionMode.Replace}) @*获取服务器时间*@ asdf 阅读全文
posted @ 2014-04-07 08:11 bl84757922 阅读(302) 评论(0) 推荐(0) 编辑
摘要: [OutputCache(Duration=15)] public ActionResult Index() { var list = db.BlogArticles.Where(a => a.AIsDel == false).ToList(); return View(list); }缓存15S 阅读全文
posted @ 2014-04-07 00:22 bl84757922 阅读(84) 评论(0) 推荐(0) 编辑
摘要: 要引入的JS文件[Required(ErrorMessage = "内容不能为空~!")]//[Range(10,100,ErrorMessage="数值必须在10~100之间")]//[RegularExpression("[a-zA-Z]+",ErrorMessage="必须是英文字母~~")]//Compare 特性 用来 约束 当前属性 必须和 指定的属性值一致!//[Compare("ATitle",ErrorMessage="你信吗?标题和内容必须一致!")][R 阅读全文
posted @ 2014-04-02 02:58 bl84757922 阅读(226) 评论(0) 推荐(0) 编辑
摘要: //1.为视图生成下拉框方法准备SelectListItem集合ViewBag.listItem=db.BlogArticleCates.Where(c=>c.IsDel==false).ToList().Select(c => new SelectListItem() { Value = c.Id.ToString(), Text = c.Name });//交给EF的LINQ不能包含非SQL语法,但是集合类型的LINQ可以包含非SQL语法(如:tostring()) //2.使用 SelectList 来准备 下拉框方法 所需的 数据 List list = db.B... 阅读全文
posted @ 2014-04-02 02:14 bl84757922 阅读(382) 评论(0) 推荐(0) 编辑
摘要: 去天堂玩~~! @Url.Action("delete", "BlogUser", new { id=1 }) @Url.Action("add", new {controller="cate",name="xiaobai",id=1 }) @Url.Content("~/cate/index") @Url.HttpRouteUrl("Default1",new {controller="home",action="index 阅读全文
posted @ 2014-04-01 02:34 bl84757922 阅读(1073) 评论(0) 推荐(0) 编辑
摘要: MVC方法之间共享数据 阅读全文
posted @ 2014-04-01 02:27 bl84757922 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 路由约束:正则表达式constraints routes.MapRoute( name: "Default2", url: "gz-{controller}/{action}/{name}/{id}", defaults: new { controller = "Home", action = "HtmlHelper"}, constraints: new { id="[0-9]+" }//路由约束 namespaces: new string[1] { "... 阅读全文
posted @ 2014-04-01 02:24 bl84757922 阅读(196) 评论(0) 推荐(0) 编辑
摘要: @Html.Raw("22") --输出不转义的HTML编码@Ajax.JavaScriptStringEndode(ViewBag.DogName) --Js字符串编码在视图上调用没返回值的方法要加{}@{Test()}调用泛型方法加()@(Test())在代码块里面直接输出字符串@strName ->aa@:strName ->strName在作用域中输出未转义的HTML代码@Html.Raw("")HtmlString htm=new HtmlString("aa");@htmvar strHtml=MvcHtmlS 阅读全文
posted @ 2014-03-29 02:50 bl84757922 阅读(399) 评论(0) 推荐(0) 编辑