I am having a form in a view page that looks as below:
<form runat="server" id="dcrsubmit">
<asp:CheckBoxList ID="CheckBoxList1" runat="server">
<asp:ListItem>test1</asp:ListItem>
<asp:ListItem>test2</asp:ListItem>
<asp:ListItem>test3</asp:ListItem>
<asp:ListItem>test4</asp:ListItem>
<asp:ListItem>test5</asp:ListItem>
<asp:ListItem>test6</asp:ListItem>
</asp:CheckBoxList>
....other controls
</form>
Now when the form is posted, I am trying to retrieve the values submitted in the controller as below:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult testmethod(FormCollection formValues)
{
string s = formvalues.get("CheckBoxList1");
.
. /* other code */
.
}
The string value shows null when I submit the form by checking some checkboxes. Is this the way to retrieve the values or am I doing something wrong? And I cannot use html control because all other controls on the form are server controls and I am not sure if I can only make this control a html control. And I am not sure how can I bind the values to it?