视图代码
@{
ViewBag.Title = “Home Page”;
}
<label id="file">用户名</label>
控制器代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace test.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
public JsonResult ajax()
{
string name = "test is ok";
return Json(name);
}
public ActionResult About()
{
ViewBag.Message = "Your application description page.";
return View();
}
public ActionResult Contact()
{
ViewBag.Message = "Your contact page.";
return View();
}
}
}
博客展示了视图代码和控制器代码。视图代码设置了页面标题,控制器代码定义了一个 Home 控制器,其中包含 Index 方法用于返回视图,整体围绕代码示例展开。
3072

被折叠的 条评论
为什么被折叠?



