Hi!
I'm attaching a small scale solution representing my own project that I have been working on and am facing an issue with a grid editor. After looking at numerous examples and Stack Overflow questions + this forum, I finally came to this setup. There is an issue in this implementation that I cannot trace out. upon making a selection in the Terminal Dropdown, an error occurs out of a dynamic script.
Secondly, one more thing that bothers me is that i need to NOT use AJAX calls for the basic IO on the list of objects. I believe it is possible to do it in memory with the datasource.data method. Still struggling with that.
In the end, once the user submits the form, I simply need to retrieve all added services from the BookedServices collection in the Save action of the Home controller. Can you please fix this for me?
9 Answers, 1 is accepted


Generally, the editor templates have predefined prefixes and hence the binding expressions in this case are not the proper ones. You can try to remove the prefix of the editor template from the
ParkingServiceDetailGrid.cshtml page:
ParkingServiceDetailGrid.cshtml
@using TelerikKendoMvc.GridWithCascadingDropdowns.ExampleProject.Models
@{ ViewData.TemplateInfo.HtmlFieldPrefix = ""; }
@model List<
ParkingServiceDetailViewModel
>
@(Html.Kendo().Grid<
ParkingServiceDetailViewModel
>()
.Name("ServiceDetailGrid")
.Columns(columns =>
...
Regarding submitting the grid with the other elements you can refer to this code library for an example - http://www.telerik.com/support/code-library/submit-form-containing-grid-along-with-other-input-elements
As for the datasource.data method it gets/sets the data of the datasource widget - http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#methods-data
Regards,
Danail Vasilev
Telerik


Ok. I removed the
*.Type(HttpVerbs.Post)
from the API calls in the Grid helper's datasource and the child dropdown started to filter. Now, the issue is that after selection, the child dropdown reverts to selected value instead of display text. What's causing that? and also, the postback URLs are still containing lots of weird characters.
The special symbols in the query string are encoded square brackets used by the server filtering of the grid. You can make a test to disable the server filtering and see that they will disappear from the query string.
Regarding the selected dropdown text from the foreign key column this is so because the passed service data to the ViewBas is empty:
columns.ForeignKey(p => p.ServiceId, (System.Collections.IEnumerable)ViewBag.Services, "Code", "NameEnglish").Width(250).EditorTemplateName("ServiceId");
ViewBag.Services =
new
List<AirportService>();
You can try to pass the actual data. See an example in this sample - https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/grid/grid-incell-editing-with-cascading-dropdownlist
Regards,
Danail Vasilev
Telerik

It is required to pass all the data because the values in the foreign columns of the grid in non-edit mode should be matched to this data.
Since, however, you have a great amount of data you can try to disable the default value binding for the ropdownlist in order to prevent initial binding when selected value is set. You can see such an approach in his example Grid editing using ComboBox with remote binding and filtering
Regards,
Danail Vasilev
Telerik
