簡體   English   中英

打開按鈕單擊彈出窗口時帶按鈕的下拉列表

[英]Dropdownlist with button when button click popup opened

你能告訴我怎么做這個嗎? 我有一個DropDownListDropDownList填充了ListItems DropDownList ,有一個名為ADD NEWButton 單擊該按鈕時,會打開一個彈出窗口。 如果項目不在DropDownList ,我想添加它。 在彈出框窗口中有一個TextBox並添加Button

基本上,如果項目不在DropDownlist我想通過單擊ADD NEW按鈕添加它。

以下內容......

string newItem = textbox1.Text;
if(ddlMyList.Items.FindByText(newItem) == null) //Means item not found
    {
    ddlMyList.Items.Add(new ListItem(newItem));
    }

在彈出窗口中輸入項目並按添加按鈕時,只需執行以下步驟:

 1. Iterate through all the elements in dropdown and check if item you want to add exist or not
 2. If item does not exist then add it to dropdown using this code:
     yourDropdown.items.Add(newitem);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM