MVC剃刀可编辑的DropDownList [英] mvc razor editable DropDownList

查看:273
本文介绍了MVC剃刀可编辑的DropDownList的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要寻找一个code键使下拉列表中的MVC剃刀编辑。
@ Html.DropDownList提供标准的选择列表,但值是不可编辑的。

I am looking for a code to make the dropdown list editable in MVC razor. @Html.DropDownList provides the standard select list, but the values are not editable.

我试过一个例子,从一个教程,但它似乎并没有工作。

I tried an example from a tutorial, but it does not seem to work.

推荐答案

首先需要将脚本引用添加到网页:

First need to add the script reference to the page:

<script type="text/javascript" src="jquery.editable-select.pack.js"></script>

这如果您的服务器上托管该脚本。

This If you host this script on your server.

您只需要在您剃刀下拉定义设置id,然后做到这一点:

You only need to set the id on you razor definition of the dropdown and then do this:

$('#nameOfDropDown').editableSelect({...});

这样做的,检查这个插件的文档,你也许可以得到一个可编辑的选择列表中。之后

After doing this and checking the documentation of this plugin you might be able to get a editable select list.

这篇关于MVC剃刀可编辑的DropDownList的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆