日期:2014-05-16 浏览次数:20761 次
namespace MvcApplication2.Models
{
public class timModels
{
String t = DateTime.Now.ToString();
public string Time
{ get{ return t; } }
}
}
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcApplication2.Models.timModels>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Index
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Index</h2>
<div class="editor-field">
<%: Html.LabelFor(m => m.Time) %>
</div>
</asp:Content>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace MvcApplication2.Controllers
{
public class timController : Controller
{
public ActionResult tim()
{ return View(); }
}
}