ASP模板页使用示例_第1页
ASP模板页使用示例_第2页
ASP模板页使用示例_第3页
ASP模板页使用示例_第4页
ASP模板页使用示例_第5页
免费预览已结束,剩余3页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、ASP模板页使用示例ASP.NET 模板页使用示例2009-10-23 10:21假如母板页MasterPage.master如下<%MasterLanguage="C#"AutoEventWireup="true"CodeFile="MasterPage.master.cs"Inherits="MasterPage" %><!DOCTYPE html PUBLIC "-/W3C/DTD XHTML 1.0Transitional/EN""http:/www.w3.o

2、rg/TR/xhtml1/DTD/xhtml1-transitional.dtd&quo t;><html xmlns="/1999/xhtml" ><head runat="server"><title> 无标题页</title></head><body><form id="form1" runat="server"><div><asp:contentplaceholder

3、id="ContentPlaceHolder1"runat="server"> </asp:contentplaceholder></div></form></body></html>你的内容页应该如下<%PageLanguage="C#"MasterPageFile="/MasterPage.master"AutoEventWireup="true"CodeFile="Default.aspx.cs"

4、Inherits="_Default"Title="Untitled Page" %><asp:ContentID="Content1"ContentPlaceHolderID="ContentPlaceHolder1"Runat="Server"><table style="width: 450px"><tr><td colspan="4" style="text-align: center&qu

5、ot;>&nbsp; </td></tr><tr><td style="width: 54px">FROM </td><td style="width: 41px"><asp:TextBox ID="TextBox1" runat="server"Width="277px"> </asp:TextBox> </td><td style="width: 37px

6、; text-align: center">TO </td><td style="width: 236px"><asp:TextBox ID="TextBox2" runat="server" Width="244px"> </asp:TextBox> </td></tr><tr><td colspan="4" style="height: 29px; text-align: ce

7、nter"><asp:Label ID="Label1" runat="server"Width="400px"> </asp:Label> </td></tr><tr><td colspan="4" style="height: 102px; text-align: center"><asp:Button ID="Button1" runat="server"

8、OnClick="Button1_Click" Text="公交查询" /><asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="打车查询" /></td></tr></table></asp:Content>注意事项:1 、建立模板页,定义好要处理的样式或页面公有信息。2 、建立内容页,内容页不能包含模板页中已经出现的元素如

9、<html><body> 等信息, 如果包含会报”内容控件必须是内容页中的顶级控件,或是引用母版页的嵌套母版页”。3、内容页引用模板页:在内容页的头文件中加入 MasterPageFile="/MasterPage.master" 如: “ <% Page Language="C#"MasterPageFile="/MasterPage.master"AutoEventWireup="true"CodeFile="Default.aspx.cs" Inherits=

10、"_Default" Title="Untitled Page" %>”。4、 模 板 页 中 的 <asp:contentplaceholderid="ContentPlaceHolder1"runat="server"> </asp:contentplaceholder> 和内容页 中 的 <asp:Content ID="Content1"ContentPlaceHolderID="ContentPlaceHolder1"Runat="Server"></asp:Content> 内容是相对应的。<asp:Content></asp:Content> 中的内容就是

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论