Overview

Description

The ASP.NET MVC DropDownList lets the user choose options from a list of choices. It provides flexible data binding, api, events, appearance customization through templates, accessibility.

Dependencies

<script type="text/javascript" src="~/Scripts/jquery-3.4.1.min.js"></script> <script type="text/javascript" src="~/Scripts/prowler-mvc.js"></script> <link rel="stylesheet" href="~/Content/prowler-mvc.css"/>
Using the System.Web.Mvc.HtmlHelper object that is used to render HTML elements, under this object the Prowler HTML helper is available in views.
@using Prowler.Mvc.UI @Html.Prowler().DropDownList()

Methods

Method name Description
BindTo(IEnumerable) Sets the data source (Model) for this Dropdown
Name(string) Sets the name of the component
DataTextField(string) Sets the field of the data item that provides the text content of the list items
DataValueField(string) Sets the field of the data item that provides the value content of the list items
HtmlAttributes(string, string) Sets the HTML attributes, can be used multiple times to add new attributes
SelectedIndex(int) Use it to set selected item index
SelectedValue(string) Use it to set selected item, mark as selected the item that has the Dropdown item value set from DataValueField(string)
Render Render the dropdown control
ClientFiltering(string) Enable dropdown search from client side, set the binding property to search in.
ServerFiltering(string, string, int) Enable dropdown search from server side
Disabled() Disable dropdown
Event(Prowler.Mvc.UI.EventDropDown, string) Configures the client-side events
GroupBy(string,string) Rearrange model elements in groups
Height(int) Set dropdown list height
Multiselect(string, bool) Enable multiselect
OptionLabelTemplate(string) Set default option label template
OptionLabelTemplate(MvcHtmlString) Set default option label template
Template(string) ValueTemplate to be used to render the selected value
Template(MvcHtmlString) ValueTemplate to be used to render the selected value