<asp:GridView ID="GridView2" runat="server" OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowEditing="GridView1_RowEditing" OnRowCommand="GridView1_RowCommand" OnRowUpdating="GridView1_RowUpdating" DataKeyNames="CallID" AutoGenerateColumns="False" Width="1342px" ShowFooter="True" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" OnRowCreated="GridView1_RowCreated" style="margin-top: 0px" OnRowDataBound="GridView2_RowDataBound"> <columns> <asp:templatefield headertext=""> <itemtemplate> <asp:CheckBox ID="CheckBox2" runat="server"> </itemtemplate> <asp:TemplateField HeaderText="Company name" Visible="False"> <itemtemplate> <asp:Label ID="Label4" runat="server" Text='<%# Eval("CallID") %>'> <br /> </itemtemplate> <edititemtemplate> <asp:TextBox ID="txtCompanyName" runat="server" Text=' <%# Eval("CallID") %>'> <asp:RadioButton ID ="txtyes" runat ="server" Text ="" /> </edititemtemplate> <asp:TemplateField HeaderText="NewNam"> <itemtemplate> <asp:Label ID="Label5" runat="server" Text='<%# Eval("NewNam") %>'> </itemtemplate> <edititemtemplate> <asp:TextBox ID="txtCompanyName" runat="server" Text=' <%# Eval("NewNam") %>'> </edititemtemplate> <asp:TemplateField HeaderText="Called No"> <itemtemplate> <asp:Label ID="Label61" runat="server" Text='<%# Eval("CalledNo") %>'> </itemtemplate> <edititemtemplate> <asp:TextBox ID="txtCompanyName" runat="server" Text=' <%# Eval("CalledNo") %>'> </edititemtemplate> <asp:TemplateField HeaderText="Call Extension"> <itemtemplate> <asp:Label ID="Label51" runat="server" Text='<%# Eval("CallExt") %>'> </itemtemplate> <edititemtemplate> <asp:TextBox ID="txtPostalAddress" runat="server" Text=' <%# Eval("CallExt") %>'> </edititemtemplate> <asp:TemplateField HeaderText="Call Duration"> <itemtemplate> <asp:Label ID="Label6" runat="server" Text='<%# Eval("CallDuration") %>'> </itemtemplate> <edititemtemplate> <asp:TextBox ID="txtResidentialAddress" runat="server" Text=' <%# Eval("CallDuration") %>'> </edititemtemplate> <asp:TemplateField HeaderText="Amount"> <itemtemplate> <asp:Label ID="Label7" runat="server" Text='<%# Eval("Amount") %>'> </itemtemplate> <edititemtemplate> <asp:TextBox ID="txtWebSite" runat="server" Text=' <%# Eval("Amount") %>'> </edititemtemplate> <asp:TemplateField HeaderText="tmpNewNam" Visible="False"> <itemtemplate> <asp:Label ID="Label50" runat="server" Text='<%# Eval("tmpNewNam") %>'> </itemtemplate> <edititemtemplate> <asp:TextBox ID="txtIfOtherSpecify" runat="server" Text=' <%# Eval("tmpNewNam") %>'> </edititemtemplate> </columns> <emptydatatemplate> <asp:RadioButton ID="RadioButton1" runat="server" /> <asp:RadioButton ID="RadioButton2" runat="server" /> <br /> </emptydatatemplate> <HeaderStyle BackColor="#00274F" ForeColor="White" /> Code Behind on button click double sum = 0; foreach (GridViewRow gvr in GridView2.Rows) { CheckBox cb = (CheckBox)gvr.FindControl("CheckBox2"); if (cb.Checked) { double amount = Convert.ToDouble(gvr.Cells[6].Text.Replace(" ", "")); sum += amount; } txtbusiness.Text = sum.ToString(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)