views:

513

answers:

1

I have a user control inside of a repeater. The user control has an ImageButton, which when clicked, should raise an event to the page which will handle the event:

//Button onClick event in user control
protected void btnOpenOption_Click(object sender, ImageClickEventArgs e)
{
    RaiseBubbleEvent(sender, e);
}

The following are two methods on the page. One to handle a BubbleEvent from a child control, the other to handle the repeater's ItemEvent command:

protected void rptProcessOptions_ItemCommand(object source, RepeaterCommandEventArgs e)
{
    //do something...
}

protected override bool OnBubbleEvent(object source, EventArgs args)
{
    //do something else...
}

I've read that the repeater ItemCommand handler should listen for the BubbleEvent from the child control and subsequently handle it, but it's not. The OnBubbleEvent handler on the page is not picking it up either. In other words, the event is just getting lost. I know it's firing because I can see that when I step through in the debugger.

I've used RaiseBubbleEvent before successfully, but never inside a repeater, so I'm not sure if what I'm attempting is correct. Any thoughts?

+1  A: 

ItemCommand is only fired if the EventArgs is an instance of RepeaterCommandEventArgs.

WildJoe