Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CheckedListBox - Checking Multiple Items
Message
 
To
18/02/2010 23:03:46
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01449851
Message ID:
01449861
Views:
22
That would cause it to continue to loop thru the inner loop after the item is found.



>Take the "break;" out.
>Tim
>
>>I have a CheckedListBox with 75 items in it. I then get a DS of 5 items. For each of the 5 items, I want to check the item in the CheckListBox. I'm searching for items by their caption.
>>
>>Only the first one is being checked.
>>
>>
>>private void _LoadContactFilters()
>>{
>>    SqlParameter pContactId = new SqlParameter("@ContactId", _Contact.RecordId);
>>    List<DbParameter> Params = new List<DbParameter>();
>>    Params.Add(pContactId);
>>
>>    DataSet dsContactFilters = csMain.DataProcs.ExecuteQuery("lb_GetFiltersForContact", Params, CommandType.StoredProcedure);
>>    if (dsContactFilters.Tables[0].Rows.Count > 0)
>>    {
>>        foreach (DataRow Row in dsContactFilters.Tables[0].Rows)
>>        {
>>            string FilterCaption = dsContactFilters.Tables[0].Rows[0]["Caption"].ToString();
>>
>>            for (int i = 0; i < chklFilters.Items.Count; i++)
>>            {
>>                if (chklFilters.Items[i].ToString() == FilterCaption)
>>                {
>>                    chklFilters.SetItemChecked(i, true);
>>                    break;
>>                }
>>            }
>>        }
>>    }
>>}
>>
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform