0

我在 Gridview 中有下拉列表,其中包含药物名称。我希望当医生打开该页面时,他可以添加列表中不存在的药物,这可能..??

4

3 回答 3

0

如果您仍想在下拉菜单中执行此操作,请以这种方式进行。

Add a list item named "New" with the value '-1' on dropdown selected event , check if the selected value is -1 if yes, bring up a popup with a text box or whatever with a submit & cancel button

那你就可以了。。

用于添加列表项

ddlcountry.Items.Clear();
ddlcountry.Items.Add("--Please Select country--");
ddlcountry.DataTextField = "Country";
ddlcountry.DataValueField = "CountryId";
ddlcountry.DataBind();

if (ddlrecipient.SelectedItem.Text == "New")
    {
        //Some code here
    }

希望这可以帮助

于 2013-03-19T11:07:39.890 回答
0

看看这是否可以帮助你。

http://www.devcurry.com/2011/05/jquery-editable-combo-box.html

当新药添加到列表中时,您需要对服务器进行 jquery 调用以将药物添加到数据库中。这是一个指向 jquery ajax 的链接,在这里可能会有所帮助。

http://api.jquery.com/jQuery.ajax/

于 2013-03-19T10:49:01.910 回答
0

您需要使用基于 JavaScript 的自定义控件,例如jQuery AutoComplete。在许多库(jqWidgets、extJS 等)中还有许多其他类似的控件。

于 2013-03-19T10:49:59.183 回答