We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to bind ejDropDownList to a MVC list?

Description

Populate the DropDownList control by using generic list.

Solution

To bind the DropDownList by using MVC generic list, the list of values from controller to the view is passed as illustrated in the following code example.

CS

Create the class “Bikes and define the properties in that class section, so that it is used in the controller. Refer to the following code to define the class.

public class Bikes

{

public string text { get; set; }

public string bikeid { get; set; }

}

Create the strongly typed view by using generic list class, to get the list of values as illustrated in the following code example.

CSHTML

In the dropdown list fields property, you can pass the following parameters other than id, text, value;

htmlAttributes,imageAttributes, imageUrl,selected,SpriteCssClass,tableName

API Reference: http://help.syncfusion.com/UG/JS_CR/ejDropDownList.html

Demo: http://mvc.syncfusion.com/demos/web/dropdownlist/databindinglocal

UG documentation: http://help.syncfusion.com/ug/js/index.html#!Documents/overview20.htm

Article ID: Published Date: Last Revised Date: Platform: Control:
4462 04/17/2015 04/17/2015 ASP.NET MVC DropDownList
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.