asp.net mvc 中 如何在视图最后强制输出内容(不用viewbag,viewdata...)
展开全部
public ActionResult UsingViewData()
{
ViewData["Title"] = " Using ViewData";
ViewData["ProjectName"] = "My Test Project";
ViewData["ProjectDescription"] = "This is Test Project to demo Viewdata and viewbag details";
ViewData["StartDate"] = new DateTime(2011, 1, 1);
ViewData["TotalPrice"] = 1000;
ViewData["TotalDays"] = 100;
Dictionary<string, string> stackholder = new Dictionary<string, string>();
stackholder.Add("Client","Mr. Client");
stackholder.Add("Manager","Mr. Joy");
stackholder.Add("Team Leader","Mr.Toy");
stackholder.Add("Sr. developer", "Mr.dojoy");
stackholder.Add("developer", "Mr. nodoy");
ViewData["stackholder"] = stackholder;
List<string> modules = new List<string>();
modules.Add("Admin module");
modules.Add("ShoppingCart module");
modules.Add("CMS module");
ViewData["modules"] = modules;
return View();
)
{
ViewData["Title"] = " Using ViewData";
ViewData["ProjectName"] = "My Test Project";
ViewData["ProjectDescription"] = "This is Test Project to demo Viewdata and viewbag details";
ViewData["StartDate"] = new DateTime(2011, 1, 1);
ViewData["TotalPrice"] = 1000;
ViewData["TotalDays"] = 100;
Dictionary<string, string> stackholder = new Dictionary<string, string>();
stackholder.Add("Client","Mr. Client");
stackholder.Add("Manager","Mr. Joy");
stackholder.Add("Team Leader","Mr.Toy");
stackholder.Add("Sr. developer", "Mr.dojoy");
stackholder.Add("developer", "Mr. nodoy");
ViewData["stackholder"] = stackholder;
List<string> modules = new List<string>();
modules.Add("Admin module");
modules.Add("ShoppingCart module");
modules.Add("CMS module");
ViewData["modules"] = modules;
return View();
)
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询