Selecting multiple checkbox inside gridview
<p>enter code hereI have a <code>CheckBox</code> inside a <code>GridView</code> template. When a <code>CheckBox</code> is checked, it should send a column value to a stored-procedure, and show the desired result in another <code>gridview</code>.
When two checkboxes are checked, the values of two columns should be displayed in the other gridview. </p>

<p>My problem is that clicking the second checkbox removes the value of first checkbox, and causes only the value of the second check box to be displayed in the other gridview.</p>

<pre><code> protected void ChkRule_CheckedChanged(object sender, EventArgs e)
    {
        StringCollection sc = new StringCollection();

        for (int i = 0; i &lt; gdYojnaDtl.Rows.Count; i++)
        {

            string yojnaNo = "";
            CheckBox chl = (CheckBox)gdYojnaDtl.Rows[i].Cells[0].FindControl("CheckBox1");
            //CheckBox chl = (CheckBox)sender;
            if (chl != null)
            {
                if (chl.Checked == true)
                {




                    int rowsNo = (Convert.ToInt16(chl.ToolTip) - 1); 
                    yojnaNo = ((Label)gdYojnaDtl.Rows[rowsNo].FindControl("lblYojnaNo")).Text;
                    sc.Add(yojnaNo);


                }

            }
        }

    foreach (string obj in sc)
    {

        objyojnadetail4.YojnaNo = obj;
        DataTable city = objyojnadetail4.Selectcity();
        gdCityDetail.DataSource = city;



        gdCityDetail.DataBind();

    }

}





 &lt;Columns&gt;
                        &lt;asp:TemplateField HeaderText="Scheme Code"&gt;
                        &lt;ItemTemplate&gt;
                            &lt;asp:Label ID="lblYojnaNo" runat="server" Text='&lt;%#Eval("Yojna_No")%&gt;' /&gt;

                        &lt;/ItemTemplate&gt;
                        &lt;/asp:TemplateField&gt;
                        &lt;asp:TemplateField HeaderText="Scheme Name"&gt;
                         &lt;ItemTemplate&gt;
                     &lt;asp:Label ID="lblYojnaName" runat="server" Text='&lt;%#Eval("Yojna_Name")%&gt;' /&gt;

                        &lt;/ItemTemplate&gt;
                        &lt;/asp:TemplateField&gt;
                        &lt;asp:TemplateField HeaderText="Assistant Name"&gt;
                         &lt;ItemTemplate&gt;
                         &lt;asp:Label ID="lblAsstName" runat="server" Text=' &lt;%#Eval("Asst_Name")%&gt;' /&gt;

                        &lt;/ItemTemplate&gt;
                        &lt;/asp:TemplateField&gt;
                        &lt;asp:TemplateField HeaderText="Select for City"&gt;
                        &lt;ItemTemplate&gt;
                 &lt;asp:CheckBox ID="CheckBox1"  runat="server"    AutoPostBack="true" 
                  oncheckedchanged="ChkRule_CheckedChanged" 
                  ToolTip="&lt;%#Container.DataItemIndex+1 %&gt; "   CommandName="cbCity"/&gt;





                        &lt;/ItemTemplate&gt;
                        &lt;/asp:TemplateField&gt;

                    &lt;/Columns&gt;
</code></pre>
