ASP.NET User Control 使用方法

 
ASP.NET User Control 使用方法
 

   WebForm2.aspx
 
   <%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master"
   AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs"
   Inherits="WebApplication12.WebForm2" %>
 
   <%@ Register Src="~/UserControl1.ascx"
   TagName="TestUserControl" TagPrefix="uc1" %>
 
   ……
 
   <div style="position:relative; top:0px; left:0px;
   width:100px; height:100px; overflow:hidden;">
      <uc1:TestUserControl id="TestUserControl1" runat="server" />
   </div>