后台代码: public class DropController : Controller { // GET: Drop public ActionResult Index() { List<Province> list = new List<Province> { new Province{ I ...
分类:
Web程序 时间:
2020-02-17 15:36:13
阅读次数:
123
判断Controller请求是否来自Ajax [HttpGet] [AjaxOnly] public ActionResult GetList() { var data = dTImgIBLL.GetList(); return JsonResult(data); } AjaxOnlyAttribu ...
分类:
其他好文 时间:
2020-02-15 13:43:58
阅读次数:
83
1、在项目中存在一些情况,需要为action加一些viewbag属性增强可维护性。 [TitleFooterAttribute] // GET: yewulingyu public ActionResult Index() { int toal = 0; List<GongSiYeWu> list ...
分类:
Web程序 时间:
2020-02-05 09:35:30
阅读次数:
105
3.行为如何在MVC中实现重载,两种方式:①方法的形参不同;②MVC中独有的,根据请求方式的不同,访问到不同的行为属性重载,主要有[HTTPPOST]和[HTTPGET]两种,在MVC中,行为默认都是Get方式的请求! 4.行为的返回值:一般被定义为一个抽象类型ActionResult,主要返回的具 ...
分类:
Web程序 时间:
2020-02-02 23:41:26
阅读次数:
105
用户登录: [HttpPost] [CustomAllowAnonymous]//允许匿名登录(这个是自定义的) public ActionResult Login(string name, string password, string verify) { string formName = ba ...
分类:
其他好文 时间:
2020-02-02 11:57:56
阅读次数:
81
https://blog.csdn.net/weixin_30379911/article/details/95065387 方法一:通过Request.Form [HttpPost] public ActionResult Test() { string id=Request.Form["id"] ...
分类:
Web程序 时间:
2020-01-29 16:27:15
阅读次数:
77
1. 添加搜索功能 如何实现url添加查询字符串实现查询指定项目的功能? 来到MovisController,修改Index方法如下 public ActionResult Index(string queryString) { var movies = from m in db.Movies se ...
分类:
Web程序 时间:
2020-01-29 14:17:20
阅读次数:
86
public ActionResult Export(string queryJson) { try { var list = Biz.GetDetailView(queryJson); if (list == null) return Json(new { IsSuccess = false, M... ...
分类:
其他好文 时间:
2020-01-10 10:42:16
阅读次数:
70
1. Asp.Net MVC 简介 2. Asp.Net MVC 起步 3. Razor语法 4. 知识点补充和复习 5. Controller 给 View 传值 6. 关于 Action 的参数 7. View 的查找 8. 其他类型的 ActionResult 9. 杂项 Misc 10. 过 ...
分类:
Web程序 时间:
2020-01-03 15:35:16
阅读次数:
107
1.返回视图 return View();//返回方法名对应的视图 return View("aaa");//返回名称为aaa的视图 2.返回文本内容 return Content("hello world"); 3.返回重定向 return Redirect("https://www.baidu. ...
分类:
Web程序 时间:
2019-12-30 14:50:51
阅读次数:
97