Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CheckedListBox - Checking Multiple Items
Message
De
18/02/2010 23:03:46
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01449851
Message ID:
01449860
Vues:
23
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;
>                }
>            }
>        }
>    }
>}
>
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform