摘要: 从客户端(content="...safasasf<scrip>")中检测到有潜在危险的 Request.Form 值。 [Column(TypeName="ntext")] [MaxLength] [UIHint("Kindeditor")] [Required(ErrorMessage = "内容不能为空")] [AllowHtml] public string Content { get; set; }在Model里添加[AllowHtml]即可以避免此问题注意引用:using System.We 阅读全文
posted @ 2013-06-05 16:12 James·wang 阅读(415) 评论(0) 推荐(0)
摘要: @(i==1 ? "checked='checked'" :" ") 阅读全文
posted @ 2013-05-29 22:06 James·wang 阅读(4587) 评论(0) 推荐(0)
摘要: 首先加载如下代码:<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script><script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script> @Ajax.Actio 阅读全文
posted @ 2013-05-29 11:15 James·wang 阅读(11287) 评论(3) 推荐(1)
摘要: <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> 阅读全文
posted @ 2013-05-29 09:26 James·wang 阅读(238) 评论(0) 推荐(0)
摘要: 在Entities:DbContext里添加如下代码: protected override void OnModelCreating(DbModelBuilder modelBuilder) { modelBuilder.Entity<Account>().HasRequired(b => b.User).WithMany(a => a.Accounts).WillCascadeOnDelete(true); base.OnModelCreating(modelBuilder); }这里Account是从表... 阅读全文
posted @ 2013-05-28 15:56 James·wang 阅读(339) 评论(0) 推荐(0)
摘要: 如题,不然会出现:错误是:该字符串未被识别为有效的布尔值。的错误提示。因为使用:@Html.CheckBoxFor会生成两个隐藏的input他们的值就是false 阅读全文
posted @ 2013-05-27 16:46 James·wang 阅读(1828) 评论(0) 推荐(0)
摘要: Html.BeginForm("actionName","controllerName",FormMethod.POST,new{@class="className"}) 阅读全文
posted @ 2013-05-27 11:42 James·wang 阅读(3603) 评论(0) 推荐(0)
摘要: @Html.ActionLink("删除", "Delete", "AccType", new { id = item.Atid }, new { @onclick ="return confirm('您确定要删除该记录吗?该操作不可恢复!') "}) 阅读全文
posted @ 2013-05-26 20:57 James·wang 阅读(219) 评论(0) 推荐(0)
摘要: ViewBag.TxtCode=new SelectList(_db.table,"ValueField","TextField");@Html.DropDownListFor(d=>d.id,ViewBag.TxtCode as SelectList,"--Please Select--",new{Class="dropclass"})特定对象集合: ViewBag.ProCode = new SelectList(_db.Products.Select(p => new { p.CodePro, p 阅读全文
posted @ 2013-05-26 17:33 James·wang 阅读(643) 评论(0) 推荐(0)
摘要: 把下面这段代码放在登录用户验证以后://用户登录验证通过后判断用户是否重复登录 public void SingleUserCheck(string userid) { HttpContext httpContext = System.Web.HttpContext.Current; Hashtable userOnline = (Hashtable)httpContext.Application["Online"]; if (userOnline != null) { ... 阅读全文
posted @ 2013-05-19 20:51 James·wang 阅读(4656) 评论(3) 推荐(0)