Hello, Iam using ASP MVC5 with IgniteUI 2016.2.
How can I add custom data like token or other data when IgniteUI do some ajax to my controller?
Hello,
If you wish to add some tokens to DataSourceUrl, you may want to use igGrid’s dataSourceObject method.
The following is an example to add a parameter to DataSourceUrl at runtime.
-------------------- var queryString = $('#grid1).igGrid('dataSourceObject'); $('#grid1).igGrid('dataSourceObject', queryString + "?myParameter=XXXX");
$('#grid1).igGrid('dataBind');
//Clear the parameter. $('#grid1).igGrid('dataSourceObject', queryString);--------------------
dataSourceObject methodhttp://igniteui.com/help/api/2016.2/ui.iggrid#methods:dataSourceObject
In order to add a parameter to UpdateUrl which is used when grid’s data is updated(added or removed), you have access to updateUrl string from the grid’s dataSource.settings like below.
-------------------- var strUpdateUrl = $("#grid1").data("igGrid").dataSource.settings.updateUrl; $("#grid1").data("igGrid").dataSource.settings.updateUrl = strUpdateUrl + "?myParameter=XXXX"; $("#grid1").igGrid("saveChanges");
//Clear the parameter. $("#grid1").data("igGrid").dataSource.settings.updateUrl = strUpdateUrl;--------------------
Thank you,Mihoko Kamiishi
not working. with that solution, data will pass as additional query string. not post data. controller still cannot validate token