為了讓用戶控件能ASP
View Code
using System;
using System
using System
using System
using System
/// <summary>
/// Summary description for IGetUCable
/// </summary>
namespace Insus
{
public interface IGetUCable
{
UserControl GetUC()
}
}
有了接口之後
View Code
<%@ Control Language=
Number A: <asp:TextBox ID=
+ <br />
Number B: <asp:TextBox ID=
<asp:Button ID=
OnClick=
<br />
Result: <asp:Label ID=
Calculator
View Code
using System;
using System
using System
using System
using System
using System
using Insus
public partial class Calculator : System
{
protected void Page_Load(object sender
{
}
protected void ButtonEqual_Click
{
decimal a = decimal
decimal b = decimal
this
}
public UserControl GetUC()
{
return this;
}
}
最後是在需要加載用戶控件的aspx的Page_load事件寫
View Code
protected void Page_Load(object sender
{
IGetUCable uc
this
}
用戶控件加載之後運行效果
From:http://tw.wingwit.com/Article/program/net/201311/13440.html