Q:

CheckboxList on deselect remove the item from Bulleted list

Hi I have this piece of code where I map the selected values of my check boxes to a Bulleted list so far it work ok when I select the value - it maps to bulleted list accordingly. However, I am struggling a bit when users deselects the value. I would like it to update the bulledted list accordingly. Any help?
Here is the code:
 public List<string> elements = new List<string>();

protected void checkList_SelectedIndexChanged(object sender, EventArgs e)
        { foreach(ListItem item in checkList.Items)
            {
                if (item.Selected)
                {
                     elements.Add(item.Text);
                }
                else {//Should this else triger the deletion of the elements in the list? 
                }

            }
            foreach (object o in elements)
            {   int exists = 0;
                for (int i = 0; i < BullList.Items.Count; i++)
                {

                    if(BullList.Items[i].ToString() == o.ToString())
                    {
                        exists++;
                    }
                }
                if(exists == 0)
                {
                    BullList.Items.Add(o.ToString());
                }}}

        protected void checkList_DataBound(object sender, EventArgs e)
        {
            for (int i = 0; i < BullList.Items.Count; i++)
            {
                foreach (ListItem item in checkList.Items)
                {
                    if (BullList.Items[i].ToString() == item.ToString())
                    {
                        item.Selected = true;
                    }
                    else
                    {

                    }}}}

The DOM elements: 
  <asp:DropDownList AutoPostBack="true" ID="DropDownJobs" runat="server" Width="390px" Height="42px" Font-Names="Roboto" Font-Size="25px" DataSourceID="jobsDrop" DataTextField="MainJob" DataValueField="IDKey"></asp:DropDownList>       

           <asp:CheckBoxList OnDataBound="checkList_DataBound" AutoPostBack="true" ID="checkList" runat="server" OnSelectedIndexChanged="checkList_SelectedIndexChanged" DataSourceID="SortedListJobs" DataTextField="SubJobFamily" DataValueField="SubJobFamily" Width="406px">
            <asp:ListItem>
            </asp:ListItem>  
            </asp:CheckBoxList>

            <h6 class="List">These jobs have been selected:</h6>
            <asp:BulletedList runat="server" ID="BullList" CssClass="bullList"></asp:BulletedList/>

A:

Like you are adding item to BulletedList create a list of deselect item. And then remove it from BulletedList. Like below
 public List<string> elements = new List<string>();
 public List<string> deselect = new List<string>();

    protected void checkList_SelectedIndexChanged(object sender, EventArgs e)
    { foreach(ListItem item in checkList.Items)
        {
            if (item.Selected)
            {
                 elements.Add(item.Text);
            }
            else 
            {
             deselect.Add(item.Text);
            }

        }
        foreach (object o in elements)
        {   int exists = 0;
            for (int i = 0; i < BullList.Items.Count; i++)
            {

                if(BullList.Items[i].ToString() == o.ToString())
                {
                    exists++;
                }
            }
            if(exists == 0)
            {
                BullList.Items.Add(o.ToString());
            }
         }
      foreach (object o in deselect)
        {
            for (int i = 0; i < BullList.Items.Count; i++)
            {
                BullList.Items.Remove(o.ToString());
            }
        }
     }

