用户控件里:
/// <summary>
/// 公开按钮
/// </summary>
public Button SelectFactoryOKButton
{
get { return this.btnChooseOneFactoryOK; }
set { this.btnChooseOneFactoryOK = value; }
}
用户控件公开了那个按钮,页面里:然后页面取到给自己加一个事件
this.UCChooseOneFactory.SelectFactoryOKButton.Click += new EventHandler(SelectFactoryOKButton_Click);
protected void SelectFactoryOKButton_Click(object sender, EventArgs e)
{
if (this.UCChooseOneFactory.GetSelectFacotyID().ToString() == "0")
{
MessageBox.Show(this.upSelectProductNamePopup, "请选择一个!");
}
}
想用委托可以看看这里 http://hi.baidu.com/isbx/blog/item/85df08f7ca0fb12a730eec06.html http://www.cnblogs.com/fc5110/archive/2011/06/30/2094940.html