c# - how to check whether dropdown list has all items in the given list -
i have got requirement have got list of strings , got dropdownlist items need check whether dropdownlist has items in give list of strings or not , need return bool condition ...
for purpose have done ....
public static bool getmactheditems(dropdownlist ddllist1, dropdownlist ddllist2, string matcheditem1, string matcheditem2, string matcheditem3) { bool results =true; list<string> list1 = new list<string> {matcheditem1, matcheditem2, matcheditem3}; if (ddllist1.selectedvalue.tostring() == matcheditem1 && (list1.any(x => x.contains(ddllist2.selectedvalue.tostring())))) { results = false; } return results; } but above condition checking whether dropdownlist selected value in list or not ....
i want entire items in dropdownlist in list or not
would 1 pls on ....
var allcontained = ddlcountry.items.cast<listitem>().select(item => item.value).all(item => lst.contains(item.tostring()); try - performance stop iterating once condition broken , return false using combination of all contains.
Comments
Post a Comment