mardi 7 mars 2017

asp.net - count how many checkbox is checked then store to variable

I have my checkboxes

    <input type="checkbox" name="checkSerial" value="serial">Serial
    <input type="checkbox" name="checkProperty" value="property">Property
    <input type="checkbox" name="checkAccountable" value="accountable">Accountable
    <input type="checkbox" name="checkStatus" value="status">Status

and im sending it to a session variable

   Session["checkSerial"] = Request.Form["checkSerial"];
   Session["checkProperty"] = Request.Form["checkProperty"];
   Session["checkAccountable"] = Request.Form["checkAccountable"];
   Session["checkSeries"] = Request.Form["checkSeries"];

but im asking is how can I get the count of the checked checkboxes or maybe to count the Session I've put. Because I'm doing this in iTextSharp, and the checked will depend the columns like this.

if (theCountVariable == 7){
 PdfPTable table = new PdfPTable(7);
}

I'm not fond of JS so there is a C# solution I will be really happy.




Aucun commentaire:

Enregistrer un commentaire