We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Webforms Grid -Server Side Events

Hi

it seems the ServerDeleteRow, ServerEditRow and ServerAdd row events aren't firing?
Am I missing something obvious?

If so, could you direct me to a tutorial.
Thx
Danie

6 Replies

MS Mani Sankar Durai Syncfusion Team March 31, 2017 11:20 AM UTC

Hi Danie, 

Thanks for contacting Syncfusion support. 

We have analyzed your query and we are not able to reproduce the reported issue. We have also prepared a sample based on your requirement that can be downloaded from the below link. 
In this sample we have used server side event for Add, Edit and delete and when performing CRUD operations it trigger. 
Refer the code example. 
<ej:Grid ID="Grid" runat="server" AllowPaging="True" OnServerAddRow="Grid_ServerAddRow" OnServerDeleteRow="Grid_ServerDeleteRow" OnServerEditRow="Grid_ServerEditRow"> 
        <EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True"></EditSettings> 
            <ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings> 
        <Columns> 
... 
           </Columns> 
        </ej:Grid>   
 
 
 
 protected void Grid_ServerAddRow(object sender, Syncfusion.JavaScript.Web.GridEventArgs e) 
       { 
           EditAction(e.EventType, e.Arguments["data"]); 
       } 
 
       protected void Grid_ServerDeleteRow(object sender, Syncfusion.JavaScript.Web.GridEventArgs e) 
       { 
           EditAction(e.EventType, e.Arguments["data"]); 
       }  
 
       protected void Grid_ServerEditRow(object sender, Syncfusion.JavaScript.Web.GridEventArgs e) 
       { 
            EditAction(e.EventType, e.Arguments["data"]); 
       } 


When performing server side event we have refer the ej.webform.min.js script file below the ej.web.all.min.js in your script section.(Master page) 
<head runat="server"> 
    <meta charset="utf-8" /> 
    <title><%: Page.Title %> - Home page</title> 
    
     
   ... 
    
    <script src="Scripts/ej/ej.webform.min.js"></script> 
    <asp:ContentPlaceHolder runat="server" ID="HeadContent" /> 
    
 

You can get the ej.webform.min.js script file from your build location. 
Location: C:\installed location (x86)\Syncfusion\EssentialStudio\**.*.*.**\JavaScript\assets\scripts\common 

Refer the documentation link. 

Please let us know if you need further assistance. 

Regards, 
Manisankar Durai. 



DV Danie van Eeden March 31, 2017 01:29 PM UTC

Hi thanks for the reply.

I will take a look at your example and revert back with results.

(I have included the javascript as per your example.)

Kind Regards
Danie


DV Danie van Eeden April 1, 2017 10:11 AM UTC

Hello,

You examples works perfectly, however my own project does not..
The events simply don't kick.
I have tried using your sample version of jquery - no difference.

I have the following in my own project. You help greatly appreciated.

categories.aspx:
<%@ Page Title="" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="categories.aspx.cs" Inherits="itbiqvalue_web_admin.categories" %>
<%@ Register assembly="Syncfusion.EJ.Web, Version=14.4460.0.15, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" namespace="Syncfusion.JavaScript.Web" tagprefix="ej" %>
<%@ Register assembly="Syncfusion.EJ, Version=14.4460.0.15, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" namespace="Syncfusion.JavaScript.Models" tagprefix="ej" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div style="text-align:right">
                            <ej:Grid ID="Grid1" runat="server" AllowPaging="True" DataSourceID="dsCategories" OnServerDeleteRow="Grid1_ServerDeleteRow" OnServerEditRow="Grid1_ServerEditRow" OnServerRowSelected="Grid1_ServerRowSelected1">
                                <ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings>
                                <Columns>
                                    <ej:Column AllowEditing="False" DataType="number" Field="category_id" IsIdentity="True" IsPrimaryKey="True">
                                    </ej:Column>
                                    <ej:Column DataType="string" Field="category_description">
                                    </ej:Column>
                                </Columns>                                
                                <EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True"></EditSettings>
                            </ej:Grid>
                    <br />                   
                    </div>
    <asp:SqlDataSource ID="dsCategories" runat="server" ConnectionString="<%$ ConnectionStrings:itbiqvalueConnectionString %>" SelectCommand="SELECT * FROM [itb_categories]">
</asp:SqlDataSource>
</asp:Content>

In my Page master I have:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Master.master.cs" Inherits="itbiqvalue_web_admin.Master" %>

<%@ Register assembly="Syncfusion.EJ.Web, Version=14.4460.0.15, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" namespace="Syncfusion.JavaScript.Web" tagprefix="ej" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>  
    <style type="text/css">
      .no-fouc {display: none;}
    </style>
    <link rel='nofollow' href="Content/ej/ej.widgets.core.min.css" rel="stylesheet" />
    <link rel='nofollow' href="Content/ej/default-theme/ej.theme.min.css" rel="stylesheet" />  
       
    <script type="text/javascript" src="Scripts/jquery-1.10.2.min.js"></script>
    <script src="Scripts/jsviews.min.js"></script>    
    <script src="Scripts/jquery.easing-1.3.min.js"></script>
    <script src="Scripts/jquery.globalize.min.js"></script>    
    <script type="text/javascript" src="Scripts/jsrender.min.js"></script>
    <script src="Scripts/ej.web.all.min.js"></script>        
    <script src="Scripts/ej.webform.min.js"></script> 
.................



DV Danie van Eeden April 1, 2017 10:20 AM UTC

Hi some more info from my side.

I have deleted the grid and dropped it on the page again.
I have reset all the settings and relinked the server side event.
Still it does not respond to the delete command (ie. ServerDelete event does not fire).

I am guessing the problem lies in scripting. 
Hoping you can assist.

Danie


DV Danie van Eeden April 1, 2017 10:45 AM UTC

Hi,

my sincerest apologies..
Problem solved - it seems the script manager component got lost and was no longer on the page.
My mistake, the events are no firing as expected.

Thx for your time


MS Mani Sankar Durai Syncfusion Team April 3, 2017 11:46 AM UTC

Hi Danie, 

We are happy to hear that your problem has been solved. 

Please let us know if you need further assistance. 

Regards, 
Manisankar Duria. 


Loader.
Up arrow icon