随笔分类 - MVC
摘要:路由控制器指向Home 控制器中没有Home 就会404 , 或者更改控制器指向名字 跳转到区域下的控制器
        阅读全文
            
摘要:System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(""); sb.Append(""); sb.Append(""); sb.Append(""); sb.Append("")...
        阅读全文
            
摘要:ViewBag.model = bLL.GetModel((int)id); ViewBag.RecruitmentTime = ViewBag.model.RecruitmentTime.ToString("yyyy-MM-dd"); //格式化返回前台输出的时间 retur...
        阅读全文
            
摘要:public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); //routes.MapRout...
        阅读全文
            
摘要:这样能请求home下的updateA函数 这样能请求home下的update函数,不能请求updateA函数
        阅读全文
            
摘要:[HttpPost] public ActionResult Layedit() { var files = Request.Files; //获得所上传的所有文件 if (files.Count > 0) { HttpPostedFileBase fil...
        阅读全文
            
摘要:使用 return Json(pageList, JsonRequestBehavior.AllowGet); 返回object 使用 return Content(JsonConvert.SerializeObject(pageList, timeConverter)); //返回json字符串
        阅读全文
            
摘要://(1)返回filestream 其中:“text/plain”是文件MIME类型 public FileStreamResult download() { string fileName = "aaa.txt";//客户端保存的文件名 string filePath = Server.MapP...
        阅读全文
            
摘要:if (file != null) { string path = Server.MapPath("~/Uploads/"); //获得服务器物理路径 if (!System.IO.Directory.Exists(path))//判断目录是否存在 ...
        阅读全文
            
摘要:public ActionResult Index(string id)//主页 //参数string searchString 访问方式为index?searchString=xxxx 。参数string id 访问方式为index/x { string searchString = id; //return View...
        阅读全文
            
摘要:return new HttpStatusCodeResult(HttpStatusCode.BadRequest); //HttpStatusCode statusCode 枚举 // HttpStatusCode.BadRequest = 400, public HttpStatusCodeResult(HttpStatusCode statusCode);//带参的构造函数 Htt...
        阅读全文
            
摘要:模板(在Views下新建文件夹Shared;在Shared下新建模板页) 子页面(在views文件夹下新建视图_ViewStart)
        阅读全文
            
摘要:public class HomeController : Controller { // GET: Home public ActionResult Index() //控制器名Home下默认的一个方法 { return View();//返回视图 } [HttpPost]//表单...
        阅读全文
            
摘要://查询 //查询指定字符串出现的个数,类似于模糊查询select count(*) from Book where Name like '%字符串%' db.Book.Where(x => x.Name.Contains(txtName.Text.Trim())).Count(); //接收查询的数据 List bk = db.Book.ToList(); dataGridView1....
        阅读全文
            
 
                    
                     
                    
                 
                    
                
 
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号