I have a CompositeDataBoundControl and im trying to add a ItemCommand to it, ala the System.Web.UI.WebControls.Repeater - so like a numpty, I just thought if I reflector'ed and added the code like so, it should work:
private static readonly object EventItemCommand = new object();
protected override bool OnBubbleEvent(object sender, EventArgs e)
{
// throw new Exception();
bool flag = false;
if (e is RepeaterCommandEventArgs)
{
this.OnItemCommand((RepeaterCommandEventArgs)e);
flag = true;
}
return flag;
}
protected virtual void OnItemCommand(RepeaterCommandEventArgs e)
{
RepeaterCommandEventHandler handler = (RepeaterCommandEventHandler)base.Events[EventItemCommand];
if (handler != null)
{
handler(this, e);
}
}
public event RepeaterCommandEventHandler ItemCommand
{
add
{
base.Events.AddHandler(EventItemCommand, value);
}
remove
{
base.Events.RemoveHandler(EventItemCommand, value);
}
}
Unfortunatly, even though I have the event bound, it does not seem to fire. Iv tried to go down the route of IPostBackEventHandler, but its still not quite right (I can fire an empty event off with no args, but I cant see a decent way to call the OnItemCommand with the RepeaterCommandEventArgs
Any ideas how to get this to work?
Iv been sitting on the office for the last 4 hours trying to get this to work! Help!