title: How to calculate selected options in dropdowns inside gridview using jquery
body: <p>I have a few dropdowns in my gridview, each has 2 same options, I want to calculate out of all these dropdowns how many times is option1 selected (selectedIndex = 1) and how many times the second option is selected (selectedIndex = 2) using jQuery.</p>
  
  <pre><code>&lt;asp:GridView ID="gd1" runat="server" AutoGenerateColumns="False" 
          onrowdatabound="gd1_RowDataBound" &gt;
          &lt;Columns&gt;
                     &lt;asp:BoundField DataField="id"   Visible="False"/&gt;
                     &lt;asp:BoundField DataField="fullName" Visible="True"  
          HeaderText="Full Name"/&gt;
                        &lt;asp:TemplateField &gt;
                            &lt;ItemTemplate&gt;
   &lt;asp:DropDownList ID="ddl1" runat="server" &gt;&lt;/asp:DropDownList&gt;
                          &lt;/ItemTemplate&gt;
                        &lt;/asp:TemplateField&gt;
  
                        &lt;asp:TemplateField &gt;
                            &lt;ItemTemplate&gt;
   &lt;asp:DropDownList ID="ddl2" runat="server"&gt;&lt;/asp:DropDownList&gt;
                          &lt;/ItemTemplate&gt;
                        &lt;/asp:TemplateField&gt;
  
                        &lt;asp:TemplateField &gt;
                            &lt;ItemTemplate&gt;
   &lt;asp:DropDownList ID="ddl3" runat="server"&gt;&lt;/asp:DropDownList&gt;
                          &lt;/ItemTemplate&gt;
                        &lt;/asp:TemplateField&gt;
  
                        &lt;asp:TemplateField&gt;
                            &lt;HeaderTemplate&gt;
            &lt;asp:Label ID="Count1" runat="server" Text="First Count"&gt;&lt;/asp:Label&gt;
                            &lt;/HeaderTemplate&gt;
                            &lt;ItemTemplate&gt;
            &lt;asp:Label ID="CountSelected1" runat="server" &gt;&lt;/asp:Label&gt;
                            &lt;/ItemTemplate&gt;
                        &lt;/asp:TemplateField&gt;
  
                        &lt;asp:TemplateField&gt;
                            &lt;HeaderTemplate&gt;
         &lt;asp:Label ID="Count2" runat="server" Text="Second Count"&gt;&lt;/asp:Label&gt;
                            &lt;/HeaderTemplate&gt;
                            &lt;ItemTemplate&gt;
             &lt;asp:Label ID="CountSelected2" runat="server" &gt;&lt;/asp:Label&gt;
                            &lt;/ItemTemplate&gt;
                        &lt;/asp:TemplateField&gt;
         &lt;/Columns&gt;
  
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>In the final 2 columns I want to display the total number of selections of option1 and option2.</p>