Sandy Surwase

Sandy Surwase

  • NA
  • 287
  • 29.4k

how to get column value in grid

Aug 8 2015 10:34 AM
<asp:TemplateField HeaderText="Total price">
<ItemTemplate>
<asp:Label ID="lbltotal" runat="server" Text='<%#Item.quantity*Item.price %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
 
 this column i want in totalbill
 
protected void grdViewItem_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//totalbill += Convert.ToDecimal(e.Row.Cells[5].Text);
//totalbill += Convert.ToDecimal((Label)e.Row.FindControl("lbltotal"));
}
if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[4].Text = "Total Amount";
System.Globalization.CultureInfo info = System.Globalization.CultureInfo.GetCultureInfo("hi-IN");
e.Row.Cells[5].Text = totalbill.ToString("c",info);
}
}

Answers (3)