Checking and assigning Checkbox values to a string in C#
<p>I'm brain tired and stumped so wanted to see if anyone knows a better way to do this:</p>

<p>I have 4 checkboxes that a user can select none, one, or all, or any combo. Then in the code behind I want to check all the CheckBoxes and if it's been selected then take it's value (text) and assign it to 1 string and separate it with a comma as necessary.</p>

<p>This works great but assigns all the .Text whether or not the items have been checked.</p>

<pre><code> if (CheckBox1.Checked || CheckBox2.Checked || CheckBox3.Checked || CheckBox4.Checked)
    {
      ClientString = CheckBox1.Text + ", " + CheckBox2.Text + ", " + CheckBox3.Text + ", " + CheckBox4.Text; 
    }
</code></pre>

<p>I'm staring at it and I know the solution is really simple but I'm too tired to think clearly right now and wanted to find out what I'm doing wrong. Code is C# (ASP.NET).</p>

<p>How do I poll the 4 CheckBoxes and if it's checked then assign it's value to the string and ignore it if it isn't checked?</p>

<p>Thanks.</p>
