Tuesday, July 3, 2012

All selected values from a CheckBoxList ASP.NET



private Int32[] CheckboxListSelections(System.Web.UI.WebControls.CheckBoxList list)
    {
        ArrayList values = new ArrayList();
        for (int counter = 0; counter < list.Items.Count; counter++)
        {
            if (list.Items[counter].Selected)
            {
                values.Add(list.Items[counter].Value);
            }
        }
        return (Int32[])values.ToArray(typeof(Int32));
    }



ref:- Check it

No comments:

Post a Comment