我有一个简单的用户控件,其中包含一些按钮,它们触发我想要使用该控件的页面处理的事件。我有我的代码设置为这样:asp.net用户控制事件传播故障
public event EventHandler Cancel;
public event EventHandler Confirm;
public void Confirm_Click(object sender, EventArgs e)
{
if (Confirm != null)
Confirm(this, e);
}
public void Cancel_Click(object sender, EventArgs e)
{
if (Cancel != null)
Cancel(this, e);
}
,但是当我尝试调用这些从页面正在使用该控件的页面加载事件我没有得到任何自定义事件
的ASPX代码
<%@ Register TagPrefix="btg" TagName="CustomControl" Src="~/Search/CustomControl.ascx" %>
<btg:CustomControl ID="btgControl" runat="server" ></btg:CustomControl>
这可能是因为我在用户控件中的按钮位于更新面板中吗?
需要查看页面代码。你是否正确投射控件的类型? – womp 2010-01-06 16:46:31