0

これを行う方法の手がかりを教えていただけますか?私は、DropDownListDropDownListいっぱいのを持っていListItemsます。の後に、 ADDNEWと呼ばれるDropDownListものがあります。ボタンをクリックすると、ポップアップが開きます。アイテムがにない場合は、追加したいと思います。ポップアップボックスウィンドウに、とを追加します。ButtonDropDownListTextBoxButton

基本的に、アイテムが入っていない場合は、 [新規追加DropDownlist]ボタンをクリックしてアイテムを追加します。

4

2 に答える 2

1

アイテムを入力して追加ボタンを押したときのポップアップで、次の手順を実行します。

 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);
于 2012-06-20T11:51:07.960 に答える
1

次の行に何か...

string newItem = textbox1.Text;
if(ddlMyList.Items.FindByText(newItem) == null) //Means item not found
    {
    ddlMyList.Items.Add(new ListItem(newItem));
    }
于 2012-06-20T11:48:36.120 に答える