1、Controller类 i、Controller必须为公开类; ii、必须以Controller结尾; iii、继承Controller基类或实现IController接口的类; iv、类中必须包含数个返回值为ActionResult的公开方法,这些方法在MVC中称为Action; 2、Cont ...
分类:
Web程序 时间:
2016-11-23 19:39:57
阅读次数:
175
Controller 1、 public ActionResult DownLoad(string path,string fileName) { return File(new FileStream(path, FileMode.Open), "application/octet-stream", ...
分类:
Web程序 时间:
2016-11-19 20:51:21
阅读次数:
207
新建一个控制器啊! public ActionResult Index() { ViewBag.title = "this is title!!!"; return View(); } public ActionResult PP() { ViewBag.name = "this is PP!!!" ...
分类:
Web程序 时间:
2016-10-22 00:28:11
阅读次数:
180
首先你要有四张图片,也就是数组中的数 public ActionResult Index()//创建视图{ViewBag.list =new int[] { 5, 6, 7,8 };return View();}public ActionResult Get(int? id){FilePathRes ...
分类:
Web程序 时间:
2016-10-21 00:07:00
阅读次数:
170
Action 对Action方法的要求: public的实例方法,返回ActionResult类型; 不能被重载; 没有标志NonActionAttribute特性(NoAction); ActionResult 抽象类,ActionResult是Controller中Action的返回类型。 Em ...
分类:
Web程序 时间:
2016-10-16 01:27:40
阅读次数:
279
一、定义 MVC中ActionResult是Action的返回结果。ActionResult 有多个派生类,每个子类功能均不同,并不是所有的子类都需要返回视图View,有些直接返回流,有些返回字符串等。ActionResult是一个抽象类,它定义了唯一的ExecuteResult方法,参数为一个Co ...
分类:
Web程序 时间:
2016-10-08 23:52:35
阅读次数:
245
public ActionResult ReviewFile(string folderName, string fileBasename, string extendName) { //以后根据后缀名返回相应的文件 var fileFullName = "~/" + folderName + "/ ...
分类:
Web程序 时间:
2016-10-08 18:55:41
阅读次数:
323
[HttpPost] public ActionResult Create(FormCollection formCollection) { //foreach (string key in formCollection.AllKeys) //{ // Response.Write(key + " ...
分类:
Web程序 时间:
2016-09-16 22:43:31
阅读次数:
352
1.后台传值: 1 public class DataController : Controller 2 { 3 // GET: Data 4 public ActionResult Index() 5 { 6 //1 ViewData传值 7 ViewData["name1"] = "张三"; 8 ...
分类:
Web程序 时间:
2016-09-09 00:39:30
阅读次数:
244
1.此文章是用原生JS来进行文件的上传,有两个版本,一个不用ajax,一个用ajax。 1)非AJAX 2)AJAX 2. 后台 public ActionResult UploadBusinessImage(HttpPostedFil... ...