默认模板代码
客户端浏览器将忽视<script>块间任何字符,不在页面输出。通过<%=datatime.now.tostring() %> 将服务端代码放中间
<% @pagelanguage=”c#” autoeventwireup=”true”codefile=”default.asp.cs” inherits=”_default” %>
注:language指明编写服务器端代码所使用的语言。一个解决方案可以有多种语言,但是一个页面只允许使用一种语言。
codefile指明页面的后台编码文件的文件名(双击页面或右击选择查看代码进入)
autoeventwireup向asp.net说明如何把事件关联到事件处理方法。若为true,则页面运行时特别命名的事件处理程序pade_load()和page_init()会被asp.net自动调用。否则需要连接事件和其处理程序。
inherits表明了后台编码文件定义的命名空间和类名。
<% @pagelanguage=”c#” autoeventwireup=”true”codefile=”default.asp.cs” inherits=”_default” %>
<!doctype html public “-//w3c//dtd xhtml 1.0 transitional//en” “http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” >
<head runat=”server”>
<title>无标题页</title>
</head>
<body>
<form id=”form1″ runat=”server”>
<div>
<h1>
asp.net server controls
</h1>
<h2>
the date and time is
<%=datetime.now.tostring() %>
</h2>
</div>
</form>
</body>
</html>