c# - Get value from selected checkboxes (Checkbox array) -



c# - Get value from selected checkboxes (Checkbox array) -

i have array of checkboxes, 33 in total. because checkboxes on page, needs in array (right?).

the code-behind looks this:

checkbox[] variablename = new checkbox[33]; variablename[0] = idcheckbox1; variablename[1] = idcheckbox1; variablename[2] = idcheckbox1; variablename[3] = idcheckbox1;

and on...

asp.net:

<asp:checkbox id="idcheckbox1" runat="server" value="1" /> <asp:checkbox id="idcheckbox2" runat="server" value="2" /> ...

the checkboxes totally optional. how value of checked boxes in variable?

it not need array. how checked checkboxes in form codebehind:

var names = formcollection.allkeys.where(c => c.startswith("idcheckbox") && formcollection.getvalue(c) != null && formcollection.getvalue(c).attemptedvalue == "1");

c# asp.net arrays checkbox

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -