This is a migrated thread and some comments may be shown as answers.

Unable to cast object of type 'System.EventArgs' to type 'Telerik.Web.UI.GridCommandEventArgs'.

0 Answers 19 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sima
Top achievements
Rank 1
Sima asked on 28 Aug 2012, 10:21 PM
Hi,

I have a radgrid I am passing a datakey value as a command argument and When I try to retrieve it I am getting
Unable to cast object of type 'System.EventArgs' to type 'Telerik.Web.UI.GridCommandEventArgs'. Error.

See my Code Below.
I am looking for the solution in vb.net

Thank you,
Sima
Public Sub LbShowResults_Click(ByVal source As Object, ByVal e As GridCommandEventArgs)
            'ByVal e As Telerik.Web.UI.GridCommandEventArgs) - This also didn't work
 
            Try
 
                If e.CommandName = "ShowResults" Then
                    Dim ElectionId As String = e.CommandArgument.ToString()
                    Response.Write(Id)
                End If
            Catch ex As Exception
            End Try
        End Sub
 
<telerik:GridTemplateColumn HeaderText="ShowResults" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
    <ItemTemplate >
       <asp:LinkButton ID="LbShowResults" runat="server" Text="ShowResults"  OnClick="LbShowResults_Click" CommandName="ShowResults" CommandArgument='<%#Eval("Id") %>' >
         </asp:LinkButton>
    </ItemTemplate>
    </telerik:GridTemplateColumn>
 If I have  
       Public Sub LbShowResults_Click(ByVal source As Object, ByVal e As System.EventArgs) 
 
My LBshowResults_click is firing without any issue but I am not able to access If e.commandname = "Showresults" Part.


I need to access it outside the radgrid (that is because of my requirement)  

Tags
Grid
Asked by
Sima
Top achievements
Rank 1
Share this question
or