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
close icon

3 Questions: Missing GridEventArgs data, choose column event & localization

Hello.

I have three problems trying to use Grid control in ASP.NET.

1. Sometimes (it works in one page, but not in other) on server side events, I did not recieve the "data" in the GridEventArgs arguments array:

<asp:UpdatePanel runat="server">
<ContentTemplate>
<ej:Grid ID="Grid" runat="server" AllowPaging="True" Locale="es-ES" OnServerDeleteRow="Grid_ServerDeleteRow">
<ClientSideEvents ActionComplete="complete" />
<EditSettings AllowDeleting="true" EditMode="DialogTemplate" TitleColumn="Description" DialogEditorTemplateID="#template" ></EditSettings>            
<ToolbarSettings ShowToolbar="true" ToolbarItems="delete"></ToolbarSettings>
<Columns>
<ej:Column Field="field1" Width="120px" IsPrimaryKey="true" TextAlign="Center" Visible="true"></ej:Column>
<ej:Column Field="field2" Width="120px" IsPrimaryKey="true" TextAlign="Center" Visible="true"></ej:Column>
</Columns>
</ej:Grid>      
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger controlid="Grid"/>
</Triggers>
</asp:UpdatePanel>

This is the code in the server side:

protected void Grid_ServerDeleteRow(object sender, GridEventArgs e)
{
// e.Arguments only has 1 item: key -> action. value -> delete. No "data" key in the array
Dictionary<string, object> KeyVal = e.Arguments["data"] as Dictionary<string, object>;
string field1 = KeyVal["field1"].ToString();
// other stuff for deleting 
}

What I'm missing?


2. I want to trigger a JavaScript or server side function when the user click in the "Done" button of the column chooser, to store the column selection in a database. How can I get informed when done button is clicked?

3. I cannot chanage language to Spanish. I have added "Locale="es-ES" in the grid (see question #1), and also added this line to the head section: "<script src="Scripts/ej.culture.es-ES.min.js"></script>". I get this JavaScript error: Uncaught TypeError: ej.addCulture is not a function at ej.culture.es-ES.min.js:1.

I have been searching for documentation I have read someting about jquery version. I'm using jquery-1.10.2.min.js, that seems to be ok.

What else can I check?


Thanks


1 Reply

SA Saravanan Arunachalam Syncfusion Team September 6, 2017 05:53 AM UTC

Hi Eligio, 
Thanks for contacting Syncfusion’s support. 
Query 1: Sometimes (it works in one page, but not in other) on server side events, I did not receive the "data" in the GridEventArgs arguments array: 
We are sorry that we are unable to reproduce the reported issue and we have created a sample that can be downloaded from the below link and also refer to the screenshot. 
 
And hence could you please provide the following details. 
1.       In which case, the mentioned issue is reproduced. 
2.       Please provide the replication procedure to reproduce your reported issue. 
3.       Share the clear details to reproduce the issue. 
4.       If possible, please reproduce the issue in the above attached sample. 
Query 2: I want to trigger a JavaScript or server side function when the user click in the "Done" button of the column chooser, to store the column selection in a database. How can I get informed when done button is clicked? 
By default, the ActionBegin and ActionComplete will be trigger with requestType as columnchooser when click the “Done” button in the column chooser.  So, we suggest you to do your JavaScript functionality on either ActionComplete/ActionBegin event handler and also call the method in server side by put the ajax post back here. Please refer to the below code example. 
<ej:Grid ID="Grid" runat="server" AllowPaging="True" Locale="es-ES" ShowColumnChooser="true" OnServerDeleteRow="Grid_ServerDeleteRow"> 
                      <ClientSideEvents ActionComplete="complete" ActionBegin="begin" /> 
                      . . . 
               </ej:Grid>       
    <script type="text/javascript"> 
        function complete(args) { 
            if (args.requestType == "columnchooser") { 
                //TO do your functionality (or) 
                //Do the ajax post back to call the method in server side 
            } 
        } 
        function begin(args) { 
            if (args.requestType == "columnchooser") { 
                //TO do your functionality (or) 
                //Do the ajax post back to call the method in server side            } 
        } 
    </script> 
 
Query 3:  I get this JavaScript error: Uncaught TypeError: ej.addCulture is not a function at ej.culture.es-ES.min.js:1. 
We suspect that you have referred the culture script file before referring ej.web.all.min.js which was the cause of the issue. So, we suggest you to refer the culture script file (ej.culture.es-ES.min.js) after referring the ej.web.all.min.js file that can be refer from the below code example. 
<head>  
        <title>My first HTML page</title>  
        <!-- CSS and Script reference section -->  
        <link rel='nofollow' href="content/web/default-theme/ej.web.all.min.css" rel="stylesheet" />  
        <script src="scripts/jquery-1.10.2.min.js"> 
        </script> <script src="scripts/jsrender.min.js"></script>  
        <script src="scripts/ej.web.all.min.js"></script>  
        <script src="scripts/i18n/ej.culture.vi-VN.min.js"> 
        </script> <script src="scripts/i18n/ej.culture.fr-FR.min.js"></script>  
    </head>
 
Regards, 
Saravanan A. 


Loader.
Live Chat Icon For mobile
Up arrow icon