I have a grid with editing set to popup. The model bound to the grid has a user defined field object (consisting of an ID and description) with its own custom editor (created in the shared folder) as 2 dropdownlists cascaded. (example the grid has a field called car which is composed of manufactureID and manufactureDescription and modelID and modelDescription)
I have two issues:
1- I am not able to get the data selected from any of the dropdownlists to be passed correctly to the user defined field of the grid. It always returns null.
2- How can i use cascaded dropdownlists for "dropdownlistsfor" knowing that the name property for this dropdownlist is becoming complicated as shown by firebug for example car_manufactureID-listbox. Changing the cascade property to this name doesn't link to the dropdownlist but when specifing another name the cascade feature is working.
I believe that my issue might be in the name of the dropdownlist but it is not working even when i remove the dropdownlist name completely
Best regards,
Sameh
7 Answers, 1 is accepted
We just uploaded new CodeLibrary - Grid InLine and PopUp Editing using Cascading DropDownLists. I would suggest to check this demo project and let us know if you face any difficulties implementing this solution in your project.
Vladimir Iliev
the Telerik team
Thanks for the sample sent, but it didn't cover my question. From my research on the internet I found that the grid doesn't accept complex model with user defined objects in it instead I should use a flat structure for the grid. Is this correct?
Sameh
You are correct - currently using complex models with the Kendo Grid is not supported and you should use flat structure.
Vladimir Iliev
the Telerik team
Is this the same thing you are saying here? When will this be fixed?
I'm somewhat relieved, but wish I had a few days of my time back after fighting with this forever. Wish this was noted a little more clearly in the documentation or example pages.
From the provided information it's not clear what is the exact issue that you are experiencing - I would suggest to open a new support ticket with more details about your current grid setup and what exactly you are trying to achieve. That way we will be able to help you straight away.
Vladimir Iliev
the Telerik team
You will need to remove the save button and a few other things, but the result is that the "Employee" editor template is not used and the ID field being visible and not editable is also not working.
My scenario is identical to that example in that I am trying to use a custom editor to edit a complex property of the object the grid is displaying. When using "InCell" editing it works fine, but PopUp editing is not using the same properties.
After making changes you should end up with code close to this on the front end:
@(Html.Kendo().Grid<
Kendo.Mvc.Examples.Models.ClientOrderViewModel
>()
.Name("Grid")
.Columns(columns =>
{
columns.Command(col => col.Edit());
columns.Bound(p => p.OrderID);
columns.Bound(p => p.Employee).ClientTemplate("#=Employee.EmployeeName#");
columns.Bound(p => p.ShipAddress);
})
.Editable(editable => editable.Mode(GridEditMode.PopUp))
.Pageable()
.Sortable()
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(true)
.Events(events => events.Error("error_handler"))
.Model(model => {
model.Id(p => p.OrderID);
model.Field(p => p.OrderID).Editable(false);
})
.Read(read => read.Action("EditingCustom_Read", "Grid"))
.Update(update => update.Action("EditingCustom_Update", "Grid"))
)
)
In PopUp editing the Grid uses the EditorForModel helper to generate the template which by default does not render the editors for complex types. You could either use custom popup template as demonstrated in this code library or override the MVC default object template.
Vladimir Iliev
the Telerik team