In my cms I have dynamically created rows and in each row I have one textbox and one checkbox.
'<input value="FALSE" name="DynamicCheckbox" class="switch-input" type="checkbox" /> '
+ '<input class="playerNumber" name="DynamicTextBoxName" type="text" size="2" value="' + valueNumber + '" /> '
From code behind I want to get value from each textbox and checkbox and put them into the List object. Value from textboxes I get without problems but I can not get values from chechboxes. In code behind I have:
string[] textboxNames = Request.Form.GetValues("DynamicTextBoxName");
string[] checkbox= Request.Form.GetValues("DynamicCheckbox");
List<Classes.Player> PlayerList = new List<Classes.Player>();
for (int i = 0; i < textboxNames.Length; i++)
{
Classes.Player p = new Classes.Player();
p.name = textboxNames[i]; //WORKS FINE
p.start11 = checkbox[i]; //DOES NOT WORK WITH THIS CODE
}
- How can I get string array whith all checkbox values?
- Also, if I want to change it into a bool array instead of string array, how should I do that?