Click to See Complete Forum and Search --> : Bubble event doesn't work everytime
Takhir
October 15th, 2009, 11:39 AM
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?
JonnyPoet
October 15th, 2009, 12:27 PM
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 ?
Takhir
October 15th, 2009, 12:31 PM
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.
JonnyPoet
October 16th, 2009, 02:31 AM
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 ?
Takhir
October 16th, 2009, 02:38 AM
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.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.