Search code examples
asp.netformscheckboxservercontrols

How do mimick html checkbox array with asp.net checkbox control?


I need to send an array of checkbox values to a form on submit. Right now I am using plain old html, so it looks something like this:

<input type="checkbox" name="options[]" />

The problem with the above is that it doesn't maintain viewstate on postback, so I want to substitute that using the control (not the list, but the regular checkbox control).

The reason I don't want to use a list is because it is hard to tweak the layout and position.


Solution

  • I decided to stick with regular html form checkboxes on this one... I lose the viewstate, but it was better than the alternative.