How to select checkbox and display values in textboxes and when checkbox not selected dont show value
<p>I have created a <code>Checkboxlist</code> , <code>Button</code> and two <code>TextBoxes</code>.</p>

<p>When selecting the first value in the <code>checkboxes</code> and press <code>button</code> I want to display it in one of the <code>textboxes</code> and when I uncheck the <code>checkboxes</code> I want the value to disappear from the <code>textboxes</code>.</p>

<pre><code>if (CheckBoxPersonalInfo.Items[0].Selected)
            {
                LabelFirstName.Text = CheckBoxPersonalInfo.Items[0].Text;
            }
            else
            {
                LabelFirstName.Text = "";
            }

            if (CheckBoxPersonalInfo.Items[1].Selected)
            {
                LabelLastName.Text = CheckBoxPersonalInfo.Items[1].Text;
            }
            else
            {
                LabelLastName.Text = "";
            }
</code></pre>

<p>This code work fine , but when unchecking the LabelFirstName.Text &amp; LabelLastName.Text = ""; dont get empty</p>

<p>UPDATE</p>

<pre><code>private void ButtonOKCheckBoxes()
    {
        EMPLOYEE theEmpl;
        using (var db = new knowitCVdbEntities())
        {
            theEmpl = (from p in db.EMPLOYEES
                       where p.username == strUserName
                       select p).FirstOrDefault();
        }

        if (theEmpl != null)
        {
            PanelFullCv.Visible = true;
            LabelPleaseRegister.Visible = false;
            //CheckBoxPersonalInfo.Items[0].Text;
            if (CheckBoxPersonalInfo.Items[0].Selected)
            {
                LabelFirstName.Text = theEmpl.firstname;
            }
            else
            {
                LabelFirstName.Text = "";
            }
            //CheckBoxPersonalInfo.Items[1].Text;
            if (CheckBoxPersonalInfo.Items[1].Selected)
            {
                LabelLastName.Text = theEmpl.lastname;
            }
            else
            {
                LabelLastName.Text = "";
            }
        }

    }
</code></pre>
