2011-11-12 5 views

答えて

9

これを試してみてください...

string toMatch = drp_branch.SelectedItem.Value + "-" + txt_acc_no.Text; 
ListItem item = ListBox1.Items.FindByText(toMatch); 
if (item != null) 
{ 
    //found 
} 
else 
{ 
    //not found 
} 
+0

.....ありがとうございます。出来た。 –

+0

yikes、テキストがわからない場合はどうすればよいですか?私たちは自分自身をループしたり、Linqを使う必要があります –

0
項目がリストボックスにexsitsをあるかどうかをチェックするためにこれを使用することができます

...

string checkitem = drp_branch.SelectedItem.Value + "-" + txt_acc_no.Text; 

if ((ListBox1.Items.Contains(checkitem) == true)) 
{ 
    Response.Write("Item exists"); 
} 
else 
{ 
    Response.Write("Item not exists"); 

} 
を使用しました
関連する問題