I have checkboxes that I have created using Literal now on postback I get the checkboxes which are checked in the Request.form.Allkeys
. However I don't know how to read those values how can I use them? how can I count how many values are in there and how can I find some values in there example I want to find if the request.forum.allkey
contain forumaName0
..
thank you
Assuming you have these checkboxes in your aspx page:
<input id="Checkbox1" type="checkbox" name="forumaName0" />
<input id="Checkbox2" type="checkbox" name="forumaName1" />
<input id="Checkbox3" type="checkbox" name="forumaName2" />
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
You should be able to iterate through all the keys and check if the desired checkbox is checked:
protected void Button1_Click(object sender, EventArgs e)
{
foreach (string key in Request.Form.AllKeys)
{
Response.Write(key + "<br />");
}
Response.Write("Contain forumaName0? - " + Request.Form.AllKeys.Contains("forumaName0"));
}
EDIT - Screenshot for downvoter: