All Components


    Grid / ForeignKey column

    Drag a column header and drop it here to group by that column
    Product nameCategoryUnit price 
    • 1
    No items to display


    In this example you can see how to implement foreign key column in the Telerik MVC grid, holding DropDownList editor for data editing. The ForeignKey column definition is shown below:

    columns.ForeignKey(p => p.CategoryID, (System.Collections.IEnumerable)ViewData["categories"], "CategoryID", "CategoryName").Title("Category").Width(150);

    Here is the definition for the DropDownList user control:

    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<object>" %>
    <%= Html.Kendo().DropDownListFor(m => m)   
        .BindTo((SelectList)ViewData[ViewData.TemplateInfo.GetFullHtmlFieldName("") + "_Data"])

    ASP.NET MVC source

    Also available for:

    • foreignkeycolumn.cshtml
    • ForeignKeyColumnController.cs
    • ProductService.cs

    Support & learning resources

    Grid for other technologies