Ver Mensaje Individual
  #6 (permalink)  
Antiguo 27/02/2009, 11:39
Avatar de Peterpay
Peterpay
Colaborador
 
Fecha de Ingreso: septiembre-2007
Ubicación: San Francisco, United States
Mensajes: 3.858
Antigüedad: 16 años, 8 meses
Puntos: 87
Respuesta: GridView Totales como sacar totales

ok solo haz esto

Código:
public partial class Default4 : System.Web.UI.Page
{
   public static int total;

protected void Page_Load(object sender, EventArgs e)
{

}

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{

if (e.Row.RowType == DataControlRowType.DataRow)
{
int valueQty = 0;
if (int.TryParse(e.Row.Cells[3].Text, out valueQty))
total += valueQty;
}
if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[0].Text = string.Empty;
e.Row.Cells[1].Text = string.Empty;
e.Row.Cells[2].Text = "Total:";
e.Row.Cells[3].Text = total.ToString();
total = 0;
}
} 
}
__________________
Curso WF4
http://cursos.gurudotnet.com/ DF
Aprende HTML5