随笔分类 - ASP.NET MVC
ASP.NET MVC
摘要:private iRepostion aReposition{get {return DependencyResolver.Current.GetService<iRepostion>();}
阅读全文
摘要:int sum = Respository.getSum();viewdata["sum"] =sumviewdata["prevpage"] = Math.Max(page-1,1)viewdata["nextpage"] = Math.Min(page+1,sum/size==0?1:sum/size)viewdata["end"] = sum/size==0?1:sum/size;viedata[size]=size;viedata[start]=sum==0?sum:(page-1)*size+1;vied
阅读全文
摘要:最近为EF的事情 被搞的很窝火 软件公司 居然还在用VSS 窝火 被琐碎的事折腾的没法写代码更窝火那么小的显示器 看个东西费劲窝火整天被催进度 窝火折腾那么久 架子怎么丑 增加工作量 窝火
阅读全文
摘要:一次死机 重新打开项目 无法加载Autofac的引用把整个项目换到别的目录就可以了
阅读全文
摘要:public class PartViewController : Controller{// GET: /PartView/public ActionResult PartView(){ViewBag.Message = "Common";return View();}[ChildActionOnly]public ActionResult PartViewToLayout(){return PartialView("PartViewToLayout");}[ChildActionOnly]public ActionResult PartViewA()
阅读全文
摘要:private static void DeleteScc(){string path = @"C:\FormD";DirectoryInfo Infos = new DirectoryInfo(path);DeleteDirectoryInfo(Infos);}private static void DeleteDirectoryInfo(DirectoryInfo dInfo){FileInfo[] fs= dInfo.GetFiles();foreach(FileInfo finfo in fs)if(finfo.FullName.ToUpper().EndWith(
阅读全文
摘要:默认Views下面对应的各个Controller对应的xxx.cshtml实际情况中情况1 : 如果多站在一起的时候,用Area来分类 效果 ~Areas/OA/Views/Controller/Action.cshtml 情况2 : 如果在Views下建立OA文件夹Action.cshtml 效果~/Views/Controller/OA/Action.cshtml 这样的情况用自定义viewEngine通常我们想要的是第3中情况 先上效果 ~/Views/OA/Controller/Action.cshtml 解决办法是 用继承RazorViewEngine 首先明确三点1 MVC默认一.
阅读全文
摘要:第一步骤 Model public class Person { [Required(ErrorMessage = "请输入姓名")] public string FirstName { get; set; } [Required(ErrorMessage = "请输入名字")] public string LastName { get; set; } [Range(18, 100, ErrorMessage = "请输入{1}到{2}之间")] public int age { get; set; } [DataType(DataT
阅读全文
摘要:只需要1步View 注意红色部分@{var chart = new Chart(width:450,height:300).AddTitle("数据分析").AddTitle(name:"X",xValue:new[]{"2","3","4"}).AddTitle(name:"Y",yValue:new[]{"2","3","4"}).Save("~/Content/Images/tem.png"
阅读全文
摘要:Action public ActionResult Index() { return this.RazorView(); }ControllerExtensionspublic static class ControllerExtensions { public static ViewResult RazorView(this Controller controller) { return RazorView(controller, null, null); } public static ViewResult RazorView(this Controller controller, ob
阅读全文
摘要:Model public class SpreadsheetModel { public String fileName { get; set; } public String[,] contents { get; set; } }ACTION public ActionResult Excel() { SpreadsheetModel mySpreadsheet = new SpreadsheetModel(); mySpreadsheet.contents = new String[2, 2] { {"Cell11","Cell12"}, {&quo
阅读全文
浙公网安备 33010602011771号