
27/02/2009, 11:39
|
 | Colaborador | | Fecha de Ingreso: septiembre-2007 Ubicación: San Francisco, United States
Mensajes: 3.858
Antigüedad: 17 años, 5 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;
}
}
}
|