1 asp.net 中如何把用户控件应用于母版页

1 创建用户控件

2 在母版页中注册用户控件

3 使用

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Store.master.cs" Inherits="SportsStore.Pages.Store" %>

<%@ Register TagPrefix="SS" TagName="CatLinks" Src="~/Controls/CategoryList.ascx" %>
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SportsStore</title>
<link rel="stylesheet" href="../Content/Style.css" />
</head>
<body>
<form id="form1" runat="server">
<div id="header">
<div class="title">SPORTS STORE</div>
</div>
<div id="categories">
<SS:CatLinks runat="server" />
</div>
<div>
<asp:ContentPlaceHolder ID="bodyContent" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
上一篇:BZOJ1001 BJOI2006狼抓兔子(最小割+最短路)


下一篇:避免用户重复点击按钮(使用Enable:=False,消息繁忙时会有堵塞的问题,只能改用Sleep)