面向ASP的Telerik UI。网络核心免费下载30天试用版

服务器绑定

您可以配置Telerik UI下拉列表,以便将服务器绑定到Northwind产品使用Linq to SQL的表。

  1. 创建一个新的动作方法并传递产品表作为模型。

    public ActionResult Index() {NorthwindDataContext northwind = new NorthwindDataContext();返回视图(northwind.Products);}
  2. 使视图具有强类型。

    @ model IEnumerable < MvcApplication1.Models.Product >
  3. 添加一个服务器绑定的下拉列表。

    @(Html.Kendo().DropDownList() . name ("productDropDownList") //下拉列表的名称是必须的。datatextfield ("ProductName") //指定产品的哪个属性作为文本被DropDownList使用. datavaluefield ("ProductID") //指定产品的哪个属性作为值被DropDownList使用. bindto (Model) //将产品列表传递给DropDownList. selectedindex(10) //选择索引为10的项注意,索引是从零开始的。)
     

另请参阅

在本文中
Baidu
map