<asp:GridView ID="gvtest1" runat="server" AutoGenerateColumns="False" style="z-index: 1; left: 68px; top: 60px; position: absolute; height: 105px; width: 390px; background-color: #ECE9D8;" DataSourceID="SqlDataSource1" HorizontalAlign="Center" BorderColor="Maroon" ForeColor="#CC9900"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:CheckBox ID="chkSelect" runat="server" /> </ItemTemplate> </asp:TemplateField> </Columns>
protected void btnProcess_Click(object sender, EventArgs e) { string str = string.Empty; string strname = string.Empty; string v_amt = string.Empty; foreach (GridViewRow gvrow in gvtest1.Rows) { CheckBox chk = (CheckBox)gvrow.FindControl("chkSelect"); if (chk != null & chk.Checked) { //str += gvtest.Rows[gvrow.RowIndex].Value.ToString() + ','; str += gvtest1.DataKeys[gvrow.RowIndex].Value.ToString() + ','; strname += gvrow.Cells[2].Text + ','; v_amt += gvrow.Cells[5].Text + ','; string v_stringamt = gvrow.Cells[5].Text; int v_amt1 = Convert.ToInt32(v_stringamt); v_totamt = (v_totamt + v_amt1); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)