Bubble event doesn't work everytime
Hello, guys.
Have a problem.
Say, I have a handler from grid, that should bubble an event to the top conrols:
protected void grdCounterOffers_RemoveItemCommand(object sender, GridCommandEventArgs e)
{
base.RaiseBubbleEvent(sender, (EventArgs)e);
}
The GridCommandEventArgs is inherited from CommanEventArgs, and I need this class to have the ID of the item to be removed from grid.
Whenever I pass the e, which is not null, the handler on the top control is not called. If I pass null, it's called.
Can you please explain me why? And how can I correctly pass the desired parameter in the args to the top controls?
Re: Bubble event doesn't work everytime
Code:
protected void grdCounterOffers_RemoveItemCommand(object sender, GridCommandEventArgs e)
{
base.RaiseBubbleEvent(sender, (EventArgs)e);
}
Whats the EventArguments Class of the BubbleEvent?
Is it really EventArgs or is it another Type ?
Re: Bubble event doesn't work everytime
Quote:
Originally Posted by
JonnyPoet
Code:
protected void grdCounterOffers_RemoveItemCommand(object sender, GridCommandEventArgs e)
{
base.RaiseBubbleEvent(sender, (EventArgs)e);
}
Whats the EventArguments Class of the BubbleEvent?
Is it really EventArgs or is it another Type ?
Here're the inheritance:
public class GridCommandEventArgs : CommandEventArgs
public class CommandEventArgs : EventArgs
When I used reflector, I noticed, that there're no dependance from passed argument type.
One more thing: the event is fired from the control, which is located in a repeater on another control, and should be handled in that top control.
Re: Bubble event doesn't work everytime
Quote:
Originally Posted by
Takhir
Here're the inheritance:
public class GridCommandEventArgs : CommandEventArgs
public class CommandEventArgs : EventArgs
When I used reflector, I noticed, that there're no dependance from passed argument type....
Yes but if RaiseBubbleEvent only accepts the base Class EventArgs then IMHO it doesn't use any of your arguments which are maybe part of GridCommandEventArgs. Is there any recasting done ?
Have you already looked if grdCounterOffers_RemoveItemCommand is ever called so it is able to fire the event in the baseclass ?
Re: Bubble event doesn't work everytime
Quote:
Originally Posted by
JonnyPoet
Yes but if RaiseBubbleEvent only accepts the base Class EventArgs then IMHO it doesn't use any of your arguments which are maybe part of GridCommandEventArgs. Is there any recasting done ?
Have you already looked if grdCounterOffers_RemoveItemCommand is ever called so it is able to fire the event in the baseclass ?
Of course. The grdCounterOffers_RemoveItemCommand is being called successfully, and the event is fired. I also noticed that if the args=null, then repeater doesn't handle it and passes to the top, where I catch it successfully. But if the args is not null or whatever type is, the repeater catches it and doesn't pass it forward.