J
John Bankhead
In the situation below I am calling "OnCommand(CommandEventArgs.Empty);" from
IPostBackEventHandler.RaisePostBackEvent. but I get the compile errors:
The best overloaded method match for
'DSTControls.PortfolioDashboard.OnCommand(System.Web.UI.WebControls.CommandEventArgs)' has some invalid arguments
-and -
Argument '1': cannot convert from 'System.EventArgs' to
'System.Web.UI.WebControls.CommandEventArgs'
Why? The param in OnCommand is clearly of type CommandEventArg. Also, if I
change the type in RaisePostBackEvent to EventArgs, then the same compile
error occurs in reverse.
public virtual void OnCommand(CommandEventArgs e){
CommandEventHandler handler = (CommandEventHandler)Events[Command];
if (handler != null)
handler(this,e);
// The Command event is bubbled up the control hierarchy.
RaiseBubbleEvent(this, e);
}
private void lb_Command(object sender, CommandEventArgs e){
OnCommand(e);
}
void IPostBackEventHandler.RaisePostBackEvent(string eventArgument){
OnCommand(CommandEventArgs.Empty);
}
IPostBackEventHandler.RaisePostBackEvent. but I get the compile errors:
The best overloaded method match for
'DSTControls.PortfolioDashboard.OnCommand(System.Web.UI.WebControls.CommandEventArgs)' has some invalid arguments
-and -
Argument '1': cannot convert from 'System.EventArgs' to
'System.Web.UI.WebControls.CommandEventArgs'
Why? The param in OnCommand is clearly of type CommandEventArg. Also, if I
change the type in RaisePostBackEvent to EventArgs, then the same compile
error occurs in reverse.
public virtual void OnCommand(CommandEventArgs e){
CommandEventHandler handler = (CommandEventHandler)Events[Command];
if (handler != null)
handler(this,e);
// The Command event is bubbled up the control hierarchy.
RaiseBubbleEvent(this, e);
}
private void lb_Command(object sender, CommandEventArgs e){
OnCommand(e);
}
void IPostBackEventHandler.RaisePostBackEvent(string eventArgument){
OnCommand(CommandEventArgs.Empty);
}