GridView OnRowCommand not stepping/firing into serverside code

Posted by: dvogler on 28 September 2017, 3:45 am EST

    • Post Options:
    • Link

    Posted 28 September 2017, 3:45 am EST

    I am trying to get the OnRowCommand to trigger on the server side.

    I have included the code…any help would greatly desired.

    Dan

    aspx code

    
                    <wijmo:C1GridView ID="C1GridView1" runat="server" AutogenerateColumns="False" Height="250px" AllowSorting="True" 
                            AllowVirtualScrolling="False" FreezingMode="None" RowHeight="19" ScrollMode="Vertical" StaticColumnIndex="-1" 
                            StaticRowIndex="-1" AllowClientEditing="true" DataKeyNames="I_EMP_NUMBER"
                            OnRowCommand="C1GridView1_RowCommand" >
                        <ScrollingSettings Mode="Vertical">
                        </ScrollingSettings>
                        <CallbackSettings Action="Editing, Sorting" />
                      <Columns>   
                        <wijmo:C1BoundField DataField="Selected" HeaderText="" SortExpression="Selected" ReadOnly="False" Width="50px" />
                        <wijmo:C1BoundField DataField="S_EMP_NAME" HeaderText="Employee Name" SortExpression="S_EMP_NAME" ReadOnly="True" Width="185px" />
                        <wijmo:C1BoundField DataField="S_EMP_EMAIL_ADDRESS" HeaderText="Username / Email" SortExpression="S_EMP_EMAIL_ADDRESS" ReadOnly="False" Width="250px" />
                        <wijmo:C1BoundField DataField="I_EMP_ID" HeaderText="Emp No" SortExpression="I_EMP_ID" ReadOnly="True" Width="60px" />
                 
    
                        <wijmo:C1TemplateField HeaderText="Delete" Width="50px">
                            <ItemTemplate>
                            <asp:ImageButton ID="DeleteAllocation" CommandName="DeleteUser" Runat="server" 
                                ImageUrl="~/Images/trashcan.bmp">
                            </asp:ImageButton>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                        </wijmo:C1TemplateField>
    
                      </Columns>
                    </wijmo:C1GridView>
    
    
    

    server-side (vb)

    
        Public Sub C1GridView1_RowCommand(ByVal source As Object, ByVal e As C1.Web.Wijmo.Controls.C1GridView.C1GridViewCommandEventArgs)
            If e.CommandName = "DeleteUser" Then
                Dim myRow As GridViewRow = DirectCast(DirectCast(e.CommandSource, ImageButton).NamingContainer, GridViewRow)
    
            End If
        End Sub
    
    
  • Posted 2 October 2017, 10:51 pm EST

    Hi Dan,

    We are sorry for the delayed response.

    “RowCommand” event gets triggered when Command field button is clicked. For your reference, please refer to the following code snippet for the same:

    
      <wijmo:C1GridView ID="C1GridView1" runat="server" 
                                    AllowVirtualScrolling="False" 
                                    AutogenerateColumns="False" 
                                    Culture="en-IN" 
                                    DataKeyNames="ID" 
                                    DataSourceID="AccessDataSource1" 
                                    FreezingMode="None" 
                                    Height="500px" 
                                    RowHeight="19" 
                                    ScrollMode="Both" 
                                    StaticColumnIndex="-1" 
                                    StaticRowIndex="-1" 
                                    ShowFilter="True" 
                                    OnRowCommand="C1GridView1_RowCommand"
                                    AllowPaging="True">
    
                    <ScrollingSettings Mode="Both">
                    </ScrollingSettings>
                    <Columns>                   
                        <wijmo:C1BoundField DataField="ID" HeaderText="ID" SortExpression="ID" ReadOnly="True"> 
                        </wijmo:C1BoundField>   
                        <wijmo:C1BoundField DataField="PriceDate" HeaderText="PriceDate" SortExpression="PriceDate">
                        </wijmo:C1BoundField> 
                        <wijmo:C1BoundField DataField="High" HeaderText="High" SortExpression="High">
                        </wijmo:C1BoundField>                    
                        <wijmo:C1BoundField DataField="Low" HeaderText="Low" SortExpression="Low">
                        </wijmo:C1BoundField>
                        <wijmo:C1BoundField DataField="Close" HeaderText="Close" SortExpression="Close">
                        </wijmo:C1BoundField>
                        <wijmo:C1BoundField DataField="Volumn" HeaderText="Volumn" SortExpression="Volumn">
                        </wijmo:C1BoundField>
                        <wijmo:C1BoundField DataField="AdjClose" HeaderText="AdjClose" SortExpression="AdjClose">
                        </wijmo:C1BoundField>
                        <wijmo:C1CommandField ShowEditButton="true" ShowDeleteButton="true"></wijmo:C1CommandField>
                         
                    </Columns>
                </wijmo:C1GridView>
    
    

    Hope it helps!

    Thanks,

    Manish Kumar Gupta

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels