martes, 13 de diciembre de 2011

Asp.Net: Recuperar un valor de una celda del GridView

Una forma de recuperar un valor de una celda en el control GridView: 
Protected Sub GridView1_RowDataBound(ByVal sender As Object, _
    ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) _
    Handles GridView1.RowDataBound

    If e.Row.RowType = DataControlRowType.DataRow Then
        Dim precio As Single
        precio = DataBinder.Eval(e.Row.DataItem, "precio")
        If precio > 5 Then
            e.Row.ForeColor = System.Drawing.Color.Red
            e.Row.BackColor = System.Drawing.Color.Yellow
            e.Row.Font.Bold = True
        End If
    End If

End Sub