I am sorry to hear that the demo description is not clear enough. I read through the description and I agree that can be improved so I logged an internal task for us to enhance it.
method is invoked in the controller action which returns the view
and here is what it does:
(var dataContext =
var categories = dataContext.Categories
CategoryID = c.CategoryID,
CategoryName = c.CategoryName
.OrderBy(e => e.CategoryName);
] = categories.ToList();
] = categories.First();
It creates a list (or it could be a SelectList) of the foreign key column texts and values. The ViewData["categories"] is used to provide the text representation of the foreign key column values in the grid template, the other two parameters show which is the value and which is the text field:
columns.ForeignKey(p => p.CategoryID, (System.Collections.IEnumerable)ViewData[
The same collection is used to populate the dropdown list in the GridForeignKey.cshtml
The default category is needed for Create operations.
Let me know if you need more information.
Get quickly onboarded and successful
with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.