c# - How to check if an item exists in the checkboxlist before adding an item to the checkboxlist? -
i have checkboxlist , getting duplicate list items in checkboxlist. want check if particular item exist in checkboxlist before add together item. optimized way check?
<asp:checkboxlist runat="server" id="chkboxlist" cellpadding="5" cellspacing="5" /> chkboxlist.items.add("georgia"); chkboxlist.items.add("ohio");
before adding state checkbox list , want check state value exist in checbox list. how that?
you can utilize findbyvalue method of items property check if value exists. if value not exists method homecoming null.
by code
if(checkboxlist.items.findbyvalue("yourvalue") !=null) { // exists }
c# asp.net
No comments:
Post a Comment