平时我们在Action中编码的时候,我们都知道所有的Action返回值类型都是ActionResult,并且我们的返回值也是各种奇葩,比如:Json(),Content(),View()等等。。。当你写这个代码的时候,你是不是有一种强烈的偷窥欲。。。那这篇我们就一起来看一看。一:实例代码 1 ...
分类:
Web程序 时间:
2015-03-16 00:52:50
阅读次数:
135
支付提交页面: [HttpPost] public ActionResult index(decimal amount) { //生成订单10位序列号,此处用时间和随机数生成,商户根据自己调整,保证唯一 strin...
分类:
微信 时间:
2015-03-15 16:45:49
阅读次数:
785
类 public class UpLoadFileController : Controller { // // GET: /UpLoadFile/ public ActionResult Index() { ret...
分类:
Web程序 时间:
2015-03-13 12:16:31
阅读次数:
139
1.判断是否登陆,如果没有登陆则跳转到登陆页 public ActionResult Index() { if (!SignHelp.IsSign()) return ChangeResult(); retur...
分类:
其他好文 时间:
2015-03-12 09:42:20
阅读次数:
148
所看到的Action都是return View();我们可以看作这个返回值用于解析一个aspx文件。而它的返回类型是ActionResult如public ActionResult Index(){return View();}除了View()之外那我们这里还能用于返回什么值呢?一、ascx页面场景...
分类:
Web程序 时间:
2015-03-11 14:41:58
阅读次数:
157
页面代码如下:Controllers代码:public ActionResult Create() { List categories = categoryService.GetAll(); ViewData["Categories"] = new SelectList(...
分类:
Web程序 时间:
2015-03-10 11:45:39
阅读次数:
160
通常我们在一个ASP.NET MVC项目中创建一个Controller的时候,Index()方法默认的返回类型都是ActionResult,通过查看UML图,ActionResult实际上是一个抽象类,因此实际返回的类型是该抽象类的子类。ØActionResult及其子类的UML图有关ActionR...
分类:
Web程序 时间:
2015-03-09 22:14:23
阅读次数:
183
首先要在controller 中将选项设置成 selecList对象,并赋值给viewBag动态对象。 public ActionResult Index(string movieGenre,string searchString) { var GenreLst ...
分类:
Web程序 时间:
2015-03-06 12:27:03
阅读次数:
342
本文在于巩固基础模型绑定从URL 获取值public ActionResult About(int id) { ViewBag.Id = id; return View(); }@{ ViewBag.Title = "Ab...
分类:
Web程序 时间:
2015-03-04 19:04:59
阅读次数:
127
[OutputCache(Duration = 60, VaryByParam = "none")] public ActionResult Index() { Response.Cache.SetOmitVaryStar(true); return View(); } 以上代码在新建项目中是可以....
分类:
Web程序 时间:
2015-03-04 12:42:19
阅读次数:
1217