This is a migrated thread and some comments may be shown as answers.

Send each rows to controller

1 Answer 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
fabien
Top achievements
Rank 1
fabien asked on 25 Jun 2014, 02:10 PM
Hi,

I need to send each rows of my grid to my C# controller.
In my js code, i use this way : 

        $("#myButton").click(function () {
            debugger;
            var applicationSectionId = $("#myComboBoxSections").data("kendoComboBox").value();
            var providerName = $("#myTbName").val();
            var typeProvider = $("#myComboBoxTypes").data("kendoComboBox").value();
            var sensTraitement = $("#myComboBoxSens").data("kendoComboBox").value();
            var parameters = $('#myGid').data('kendoGrid')._data;
            $.post(_pathRoot + "AddNewProvider",
                {
                    applicationSectionId: applicationSectionId,
                    providerName: providerName,
                    typeProvider: typeProvider,
                    sensTraitement: sensTraitement,
                    parameters : parameters 
                })
            .done(function (result) {
                debugger;
            });

Here is m model in the grid :
                    model: {
                        fields: {
                            Nom: { type: "string" },
                            Valeur: { type: "string" }
                        }
                    }

My controller method, in the .cs file is like this:
public async Task<JsonResult> AddNewProvider(int? applicationSectionId, string providerName, string typeProvider, string sensTraitement, object parameters )

Each time, all data are effectively sent, except "parameters" which is {string[1]} in VS 2012 debugger, and is finally empty.
Wich class should i use tu get rows in my controller ?

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 27 Jun 2014, 01:28 PM
Hello Fabien,

Sending complex nested objects to a MVC controller is not a question related to the KendoUI framework itself.

You can search the internet for similar questions:

http://stackoverflow.com/questions/24072557/passing-nested-complex-json-to-mvc-controllers

Regards,
Petur Subev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
fabien
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or