ActionLink :
1 |
|
路由是决定程序执行控制器类中的哪一种操作方法的机制 Routing is a mechanism in MVC that decides which action method of a controller class to execute.
Request
获取视图中传递的路由参数
Ajax帮助器:在视图中将方法返回的结果显示给用户或取得方法的结果
控制器中通过ViewBag定义要传递给视图的数据,再在视图中通过ViewBag获取并呈现数据
public class chDemoController:Controller
{
public ActionResult ViewDataViewBag()
{
ViewData["Name"]=="zhangsan";
ViewBag.Name="zhangsan";//定义
List<string> myColors=new List<string>
{
"red,hongse","green,lvse","blue,lanse"
};
ViewData["MyColors"]=myColors;
ViewBag.MyColors=myColors;
return PartialView();
}
}
1 |
|
本文共945字符