2013-03-19 55 views
0

我在Gridview中包含下拉列表,其中包含Medicines的名稱。我想當醫生打開那個頁面時,他可以添加一個不在列表中的藥物,這是否可能..?我們可以在編譯後在下拉列表中添加一個項目

+0

你的下拉列表中可能來臨從數據庫中的表中SE。您可以提供一個界面來修改查找表,它將在網格視圖中提供 – Habib 2013-03-19 10:29:49

+0

是的,可能的話,您希望如何做,客戶端或服務器端,您可以使用JavaScript添加到客戶端或回發到服務器,插入數據庫,重新加載並顯示它。 – TalentTuner 2013-03-19 10:30:35

+0

Saurabh,我希望它在clint方面,但無法弄清楚如何。如何編輯一個已經有一些數據的下拉列表。 – 2013-03-19 10:37:22

回答

0

你需要使用一個基於自定義JavaScript控制像jQuery AutoComplete。許多其他類似的控件也在許多庫中(jqWidgets,extJS等)。

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 
    } 

希望這有助於

相關問題