C# 用户控件单击绑定不工作

C# 用户控件单击绑定不工作,c#,user-controls,C#,User Controls,我的用户控件(SefAttributes.ascx)有问题。我的用户控件中有2个文本框、1个标签和1个按钮。在主页(SantiyeGiris2.aspx)中,我是数据绑定。我正在动态添加此用户控件,我想在用户单击“删除”按钮时删除该行,但我的单击事件不起作用 我的用户控制代码如下所示: public event EventHandler SefSilClicked; protected void btnSefSil_Clicked(object sender, EventArgs e) {

我的用户控件(SefAttributes.ascx)有问题。我的用户控件中有2个文本框、1个标签和1个按钮。在主页(SantiyeGiris2.aspx)中,我是数据绑定。我正在动态添加此用户控件,我想在用户单击“删除”按钮时删除该行,但我的单击事件不起作用

我的用户控制代码如下所示:

public event EventHandler SefSilClicked;

protected void btnSefSil_Clicked(object sender, EventArgs e)
{
    if (this.SefSilClicked != null)
    {
        this.SefSilClicked(this, e);
    }
}
在SantiyeGiris2.aspx.cs中,我的绑定方式如下:

protected void rptSantifeSefDataBound(object sender, RepeaterItemEventArgs e)
{
    SefAttributes sa = (SefAttributes)(e.Item.FindControl("sfDiv"));
    SantiyePersonel sp = (SantiyePersonel)(e.Item.DataItem);
    sa.txtSefBas.Text = sp.BaslangicFormatlanmis;

    if (Convert.ToDateTime(sa.txtSefBas.Text) < System.DateTime.Now)
        sa.txtSefBas.Enabled = false;

    sa.txtSefBit.Text = sp.BitisFormatlanmis;
    sa.lbl.Text = sp.PersonelTamAdi;

    sa.SefSilClicked += new EventHandler(RptSefSilClicked);
}

我看不出有什么问题。如果有人能帮助我,我将不胜感激。

你是说没有被解雇?还有,我想是asp.net吧?我们可以看一下标记页吗?是的,它没有被触发。每次SefSilClicked属性为null,它是asp.NET。在页面加载时是否再次绑定项目?实际上,我正在使用“添加”按钮动态添加用户控件,由于某些原因,我必须在页面加载中提供repeater datasource和databind,而不是回发。您必须在回发时再次绑定这些项。@@”
protected void RptSefSilClicked(object sender, EventArgs e)
{
    YP_SANTIYE.WindowScripts.Alert("click activated.");
}