# Help with code behind asp.net

**URL:** <https://forum.kirupa.com/t/help-with-code-behind-asp-net/263916>\
**Category:** Uncategorized\
**Created:** [June 20, 2008, 1:26pm UTC](https://forum.kirupa.com/t/help-with-code-behind-asp-net/263916 "2008-06-20T13:26:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Navarone](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@Navarone](https://forum.kirupa.com/u/Navarone)\
**Post date:** [June 20, 2008, 1:26pm UTC](https://forum.kirupa.com/t/help-with-code-behind-asp-net/263916/1 "2008-06-20T13:26:19Z")

</div>

I need some help with my code behind for my [asp.net](http://asp.net) contact form. I will show a few snippets but what I want to do is get the values of my check box. So my form looks like this:

```auto

...html 
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]<[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]asp[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]:[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]CheckBox[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#ff0000][SIZE=2][COLOR=#ff0000]ID[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]="CheckBox1"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#ff0000][SIZE=2][COLOR=#ff0000]Text[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]="Designer Series"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#ff0000][SIZE=2][COLOR=#ff0000]runat[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]="Server"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]/>[/COLOR][/SIZE][/COLOR][/SIZE]

```

[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]For my code behind I show this:[/COLOR][/SIZE][/COLOR][/SIZE]

```auto

[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//check boxes[/COLOR][/SIZE]
[/COLOR][/SIZE][SIZE=2]objSB.Append([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"Please contact me about the following product lines: <br>"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
[SIZE=2]objSB.Append(CheckBox1.Text + [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"<br>"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
[/COLOR][/SIZE][/COLOR][/SIZE]

```

[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]

[SIZE=2]This gives me the text of the checkbox in a reply email but doesn’t tell me if the user selected it. How do I code/indicate this?[/SIZE]  
[/COLOR][/SIZE][/COLOR][/SIZE]

---

<div class="post-metadata">

**Author:** ![pixelSnobbery](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@pixelSnobbery](https://forum.kirupa.com/u/pixelSnobbery)\
**Post date:** [June 21, 2008, 4:14pm UTC](https://forum.kirupa.com/t/help-with-code-behind-asp-net/263916/2 "2008-06-21T16:14:05Z")

</div>

You could use an if statement to check which checkboxes are checked:

```auto

If Checkbox1.checked = true then
objSB.Append(CheckBox1.Text + "Yes")
Else
objSB.Append(CheckBox1.Text + "No")
End If

```

A bit tedious if you’ve got loads of different checkboxes, but it’ll be ok as long as you’ve only got a few.
