How to add parameter in ClientSideEvents?

Hi, I'm trying to pass a few parameters when creating a grid, but it does not work

code:

.ClientSideEvents(ev => ev.Create(String.Format("someScript('{0}', '{1}')", 1, 2)))

3 Replies

VN Vignesh Natarajan Syncfusion Team November 13, 2017 04:20 PM UTC

Hi John, 

Thanks for using Syncfusion products 

We have analyzed your query and we suspect that you want to add parameter in ClientSide event while rendering a Grid. Client Side events will have own parameters which cannot be modified. So you cannot add parameter like you asked. Refer the below link for client side events and it predefined parameters 


Please explain your query with more details so that we can help you better 


Regards, 
Vignesh Natarajan 



JO John replied to Vignesh Natarajan November 14, 2017 07:10 AM UTC

Hi John, 

Thanks for using Syncfusion products 

We have analyzed your query and we suspect that you want to add parameter in ClientSide event while rendering a Grid. Client Side events will have own parameters which cannot be modified. So you cannot add parameter like you asked. Refer the below link for client side events and it predefined parameters 


Please explain your query with more details so that we can help you better 


Regards, 
Vignesh Natarajan 


Hello, as I wrote here, I have a problem with the data source, and I wanted to call the function when creating the grid and pass a couple of parameters, eg ID and type



TS Thavasianand Sankaranarayanan Syncfusion Team November 15, 2017 12:39 PM UTC

Hi John, 

We have analyzed your query and we suspect that you want to pass additional parameter to the Query to the dataManager. So, we suggest you to pass that additional parameter using the addParams property of ejQuery

Refer the below code example. 

[GridFeatures.cshtml] 

@(Html.EJ().Grid<OrdersView>("FlatGrid") 
   .Datasource(ds => ds.URL("/Grid/DataSource").Adaptor(AdaptorType.UrlAdaptor)) 
    .Query("ej.Query().addParams('valtype','number').addParams('id',10251)") 
   .EnableAltRow() 
    
    ---- 
   
   .Columns(col => 
            { 
                ---- 
 
            }) 
    ) 
 
-------------------------------------------------------------------- 
[GridController.cs] 

public ActionResult DataSource(DataManager dm, int? id, string valtype) 
         
        { 
            IEnumerable DataSource = new NorthwindDataContext().OrdersViews.ToList(); 
             
 
             ---- 
 
       } 
 


We have prepared a sample and it can be downloadable from the below location. 


Refer the help documentation. 


Regards, 
Thavasianand S. 


Loader.
Up arrow icon