一、所有的Controller都继承自System.Web.Mvc.Controller 目前ASP.NET MVC3默认提供了多种ActionResult的实现,在System.Web.Mvc命名空间里。 其中ActionResult是一个抽象类,所有一下的Result都继承自它,因此如果一个.....
分类:
Web程序 时间:
2015-01-05 16:24:06
阅读次数:
130
public ActionResult Img() { // 获取博客园空间顶部的banner图片 WebRequest req = WebRequest.Create("http://space.cnblogs.com/images/a4/...
分类:
Web程序 时间:
2015-01-01 11:13:39
阅读次数:
166
1 2 3 4 @section Scripts 5 { 6 7 8 } 9 10 Javascript 1 //独立部署的图片服务器 2 public ActionResult Index() 3 { 4 //if (Request.HttpMethod == ...
分类:
Web程序 时间:
2014-12-30 18:34:58
阅读次数:
1885
在HomeControl中添加一个Action,代码如下: public ActionResult Add()
{ return View();
} 当View()中不写任何参数时,默认会调用同名的视图,添加一个视图Add.cshtml,同时添加一个表单,代码如下: @using (Html.Beg...
分类:
Web程序 时间:
2014-12-30 01:41:37
阅读次数:
310
子页面AreaSelect.cshtml页面的Controller代码:public ActionResult AreaSelect(){ return PartialView();}父页面前台代码: @{ ViewDataDictionary data = new Vi...
分类:
Web程序 时间:
2014-12-26 11:07:36
阅读次数:
134
EasyUI的datagrid分页前台代码:View Code后台:public ActionResult TouBiZhaoLingSearch(string startDate, string endDate, int page, int rows){ int totalCount; ...
分类:
其他好文 时间:
2014-12-20 22:05:41
阅读次数:
294
返回JsonResult序列化的Json对象 public class MyController : Controller{ // 必须返回ActionResult类型 public ActionResult HelloWorld() { ViewData["Message"] = "Hello W...
分类:
Web程序 时间:
2014-12-18 16:54:23
阅读次数:
146
MVC 中有许多自定义的 ActionResult,自定义 ActionResult 的方法是继承 ActionResult,如下例:public class XmlResult : ActionResult{ // Properties public XDocument Data { ...
分类:
其他好文 时间:
2014-12-17 18:01:55
阅读次数:
124
类名抽象类父类功能ContentResult 根据内容的类型和编码,数据内容.EmptyResult 空方法.FileResultabstract 写入文件内容,具体的写入方式在派生类中.FileContentResult FileResult通过 文件byte[] 写入文件.FileP...
分类:
其他好文 时间:
2014-12-12 19:02:07
阅读次数:
189
data是json数据。传递到的Action是/Home/MyAjax。那么在Action方法处接收的方式如下:public ActionResult MyAjax(string val1) { string val2 = Request["val2"].To...
分类:
Web程序 时间:
2014-12-10 16:15:48
阅读次数:
331