আমার সম্পর্কে

বুধবার, ১৮ আগস্ট, ২০১০

This code is used to calculate asp.net with c#.net gridview column value

private void CalcTotal(string _price)


{

try

{

runningTotal += Decimal.Parse(_price);

}

catch (Exception ex)

{

HttpContext.Current.Response.Write(ex.ToString());

}

}

private decimal runningTotal = 00;

private int index = 0;
protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)

{

try

{
if (e.Row.RowType == DataControlRowType.DataRow)

{

CalcTotal(e.Row.Cells[2].Text);


}

else if (e.Row.RowType == DataControlRowType.Footer)

{

e.Row.Cells[1].Text = "Total :";

e.Row.Cells[2].Text = String.Format("{0:c}", Convert.ToDecimal(runningTotal)); //Show total qty

runningTotal = 00;

index = 0;

}

}

catch (Exception ex)

{
HttpContext.Current.Response.Write(ex.ToString());
}
}

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন