How to insert drop down list box in a Telerik grid

12,884

Solution 1

You can set the template of the column to embed arbitrary HTML. If using Ajax binding - try the client template. The following online examples will be helpful:

  1. Server templates
  2. Client templates

Solution 2

I need to do that for my project. Here is how I did it:

columns.Bound(o => o.Role).ClientTemplate(
                Html.Telerik().DropDownList()
                    .Name("RoleList<#= UserID #>")
                    .BindTo(new SelectList(UserController.GetRoles()))
                    .ToHtmlString()
            );

The static method GetRoles returns a simple IEnumerable of String. You still can return a custom object by using a different SelectList constructor to specify Value and Text property of your custom object.

new SelectList(UserController.GetCustomRoles(), "RoleID", "ShortName")
Share:
12,884
kumar
Author by

kumar

I am working as Technical Lead exp in asp.net,javascript,jquery,ajax.. etc..

Updated on November 20, 2022

Comments

  • kumar
    kumar over 1 year

    I have a Telerik Grid, with two columns I need to keep second column as drop-down list box with in the grid, I am using ASP.NET MVC control

    Can any body tell me how to do this?

  • GazB
    GazB over 9 years
    As you used links for this answer instead of answering directly here this answer is now useless as the links are 404ing.
  • GazB
    GazB over 9 years
    I have updated the links to use The Way Back Machine's archive so the answer could still be useful. :)