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

Nested custom type is null

1 Answer 100 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rafik
Top achievements
Rank 1
Rafik asked on 25 Jan 2013, 02:45 PM
I have a model with preoperty of custom type
It's bound to drop down editor in web grid

 $("#grid").kendoGrid({
 dataSource: {
schema: {
            model: {
                    .....
                    fields: {
                            Site: { validation: { required: true }, editable: true },
  }
}
}

columns: [
                {
field: "Site",
                  editor: siteDropDownEditor,
                  template: "#=Site.SiteName#"
}]

The problem is that when Update hits controller's method nested custom type is null/empty (like in image)
Please advise where is mistake


1 Answer, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 29 Jan 2013, 09:41 AM
Hello again,

I posted my reply in the support ticket on the same topic. For convenience I am pasting it below:

The DefaultModelBinder will not be able to bind the object in the format it is sent by default. You should use the transport.parameterMap function to convert the data in a format that can be processed on the server. In this case, you can either use JSON:

update: {
    url: "url",
    dataType: "json",
    contentType: "application/json"
},
parameterMap: function(options, operation) {
    if (operation !== "read") {
        return kendo.stringify(options);
    }
}
or convert the object as form data(fieldName.nestedFieldName).

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