ASP。. NET MVC组合框概述

面向ASP的Telerik UI。NET MVC忍者图像

组合框是的一部分面向ASP的Telerik UI。NET MVC一个专业级的UI库,包含 110+ 组件,用于构建现代和功能丰富的 应用程序。要想尝试一下,注册一个30天的免费试用。

Telerik UI ComboBox HtmlHelper for ASP。NET MVCis a server-side wrapper for the Kendo UI ComboBox widget.

组合框显示一个值列表,并允许从列表中进行单个选择。

初始化组合框

下面的示例演示如何定义ComboBox。

@(Html.Kendo(). combobox (). name ("combobox") . datatextfield ("ProductName") . datavaluefield ("ProductID") . datasource (source => {source。读取(Read =>{读取。行动(“Products_Read”、“组合框”);});}))
ComboBoxController: Controller {public IActionResult Index() {return View();}公共JsonResult Products_Read() {var result = Enumerable。范围(0,50)。Select(i => new ProductViewModel {ProductID = "" + i, ProductName = "Product " + i});返回Json(结果);}}

基本配置

下面的示例演示了ComboBox的基本配置。

@(Html.Kendo(). combobox (). name ("combobox") . datatextfield ("ProductName") . datavaluefield ("ProductID") . htmlattributes (new {style = "width:100%"}) . filter ("contains") . minlength (3) . height (290) . headertemplate (" 
" + "Products" + " "
") . footertemplate ("Total #: instance.dataSource.total() # items found") . datasource (source => {source;读取(Read =>{读取。行动(“Products_Read2”,“它”);}) .ServerFiltering(假);}) . events (e => e. change ("onChange") . select ("onSelect") . open ("onOpen") . close ("onClose") . databound ("onDataBound") . filtering ("onFiltering"))