Okay, so it displays in the .NET API APIs that the CommandArgument property of the CommandEventArg class is of type 'object', suggesting that I can assign it something other than a string object, but I get an InvalidCastException using the following code:
[aspx code]
...
<asp:Button ID="Button1" runat="server" CommandArgument='<%# context %>' oncommand='reviewContext' </asp:Button>
...
[aspx.cs codebehind code]
...
public Enum Context { C1, C2, C3 }
public Context context { get { return Context.C1; } }
...
public void reviewContext (object sender, CommandEventArg e) {
if((Context) e.CommandArgument == Context.C1) { }
}
Why does this tabu property assign something other than a string to the CommandEventArg property?
source
share