All Components


    Grid / ForeignKey column


    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.aspx
    • foreignkeycolumn.cshtml
    • ForeignKeyColumnController.cs
    • ProductService.cs
    • Widget configuration

    Support & learning resources

    Grid for other technologies