This way:
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CssClass="dataTables_wrapper"
CellPadding="4" OnRowDataBound="GridView_RowDataBound" ForeColor="#333333" GridLines="None">
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox runat="server" ID="chk1" />
</ItemTemplate>
<HeaderTemplate>
<asp:CheckBox runat="server" ID="chkAll" onclick="javascript:SelectAllCheckboxes(this);" />
</HeaderTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Booking_Date" HeaderText="Date">
<HeaderStyle Width="10%" />
<ItemStyle Width="10%" />
</asp:BoundField>
<asp:BoundField DataField="Booking_Pax_Name" HeaderText="Pax_Name" />
<asp:BoundField DataField="Booking_Ticket_Number" HeaderText="Ticket_Number" />
<asp:BoundField DataField="Booking_Sector" HeaderText="Sector" />
<asp:BoundField DataField="Booking_Travel_Date" HeaderText="Travel_Date" />
<asp:BoundField DataField="Booking_Airline_Details" HeaderText="Airline_Details" />
<asp:BoundField DataField="Booking_Basic_Amount" HeaderText="Basic_Amt" />
<asp:BoundField DataField="Booking_Tax_Amount" HeaderText="Tax_Amt" />
<asp:BoundField DataField="Booking_Net_Payable" HeaderText="Net_Payable" />
</Columns>
<EditRowStyle BackColor="#999999" />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
</asp:GridView>
<asp:Label ID="lblTax" Text="0" runat="server" /><br />
<asp:Label ID="lblBasic" Text="0" runat="server" /><br />
<asp:Label ID="lblPayable" Text="0" runat="server" /><br />
</div>
</form>
C#:
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.PopulateGrid();
}
}
private void PopulateGrid()
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[9]{
new DataColumn("Booking_Pax_Name", typeof(string)),
new DataColumn("Booking_Ticket_Number", typeof(string)),
new DataColumn("Booking_Sector", typeof(string)),
new DataColumn("Booking_Travel_Date", typeof(string)),
new DataColumn("Booking_Date", typeof(string)),
new DataColumn("Booking_Airline_Details", typeof(string)),
new DataColumn("Booking_Basic_Amount", typeof(int)),
new DataColumn("Booking_Tax_Amount", typeof(int)),
new DataColumn("Booking_Net_Payable", typeof(int))});
dt.Rows.Add("Test", "Abc001", "Booking_Sector1", "22/12/2013", "22/12/2013", "Air India", 4000, 150, 4500);
dt.Rows.Add("Test", "Abc001", "Booking_Sector1", "22/12/2013", "22/12/2013", "Air India", 4000, 150, 4500);
dt.Rows.Add("Test", "Abc001", "Booking_Sector1", "22/12/2013", "22/12/2013", "Air India", 4000, 150, 4500);
this.GridView1.DataSource = dt;
this.GridView1.DataBind();
}
protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
this.lblBasic.Text = (int.Parse(this.lblBasic.Text) + int.Parse(e.Row.Cells[7].Text)).ToString();
this.lblTax.Text = (int.Parse(this.lblTax.Text) + int.Parse(e.Row.Cells[8].Text)).ToString();
this.lblPayable.Text = (int.Parse(this.lblPayable.Text) + int.Parse(e.Row.Cells[9].Text)).ToString();
}
}
Thank You.