Server Error in '/CTD_Development' Application.<br/>
Unable to cast object of type 'System.EventArgs' to type 'System.Web.UI.WebControls.CommandEventArgs'.<br/>
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.<br/>
<br/>
Exception Details: System.InvalidCastException: Unable to cast object of type 'System.EventArgs' to type 'System.Web.UI.WebControls.CommandEventArgs'.<br/>
<br/>
Source Error:<br/>
<br/>
Line 59: </asp:TableCell><br/>
Line 60: <asp:TableCell ID="tblViews_Cell3" BorderColor="#993399" BorderWidth="2"><br/>
Line 61: <asp:Button ID="ButtonAllOpenTesting" runat="server" CommandArgument=3 OnClick="testclick" Text="All Open Testing" BorderStyle="None" Font-Bold="True" /><br/>
Line 62: </asp:TableCell><br/>
Line 63: <asp:TableCell ID="tblViews_Cell4" BorderColor="#993399" BorderWidth="2"><br/>
<br/>
<br/>
Source File: C:\Documents and Settings\bwferderer\My Documents\Visual Studio 2005\WebSites\CTD_Development\open_contracts.aspx Line: 61<br/>
<br/>
Stack Trace:<br/>
<br/>
[InvalidCastException: Unable to cast object of type 'System.EventArgs' to type 'System.Web.UI.WebControls.CommandEventArgs'.]<br/>
ASP.open_contracts_aspx._Lambda$__3(Object a0, EventArgs a1) in C:\Documents and Settings\bwferderer\My Documents\Visual Studio 2005\WebSites\CTD_Development\open_contracts.aspx:61<br/>
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111<br/>
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110<br/>
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10<br/>
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13<br/>
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36<br/>
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565<br/>
<br/>
<br/>
Version Information: Microsoft .NET Framework Version:2.0.50727.3082; ASP.NET Version:2.0.50727.3082
This is the error to my onclick even of a button trying to pass and argument to my procedure call.
Line 61 shows the button code.
Here is the code for "testclick" procedure on my aspx.vb page.
Protected Sub testclick(ByVal Sender As Object, ByVal E As CommandEventArgs)
'Set all views to non-active color
DefColors()
'Set requested view to active color
Select Case E.CommandArgument
Case Is = 1
Me.tblViews_Cell1.BackColor = Drawing.Color.DarkMagenta
Me.ButtonMyTestingAssignments.BackColor = Drawing.Color.DarkMagenta
Me.ButtonMyTestingAssignments.ForeColor = Drawing.Color.White
Case Is = 2
Me.tblViews_Cell2.BackColor = Drawing.Color.DarkMagenta
Me.ButtonAllOpenTesting.BackColor = Drawing.Color.DarkMagenta
Me.ButtonAllOpenTesting.ForeColor = Drawing.Color.White
Case Is = 3
Me.tblViews_Cell3.BackColor = Drawing.Color.DarkMagenta
Me.ButtonMyQAAssignments.BackColor = Drawing.Color.DarkMagenta
Me.ButtonMyQAAssignments.ForeColor = Drawing.Color.White
Case Is = 4
Me.tblViews_Cell4.BackColor = Drawing.Color.DarkMagenta
Me.ButtonAllopenQAAssignments.BackColor = Drawing.Color.DarkMagenta
Me.ButtonAllopenQAAssignments.ForeColor = Drawing.Color.White
End Select
End Sub
Please help me understand and correct this.