Este es mi codigo
Código ASP:
Ver originalImports System.Web.UI.WebControls
Imports System.Data.SqlClient
Imports System.Data
Partial Class Registro
Inherits System.Web.UI.Page
Private Function Traer_Datos() As DataTable
Dim cnn As New SqlConnection("server=.;database=Prueba;integrated security=true")
Dim dat As New SqlDataAdapter("sps_evaluacion", cnn)
Dim tabla As New DataTable
dat.Fill(tabla)
Return tabla
End Function
Private Sub cargar_grilla()
GridView1.DataSource = Traer_Datos()
GridView1.DataBind()
End Sub
Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing
Dim fecha1 As String = GridView1.Rows(e.NewEditIndex).Cells(6).Text
Dim fecha2 As String = GridView1.Rows(e.NewEditIndex).Cells(8).Text
Dim fecha3 As String = GridView1.Rows(e.NewEditIndex).Cells(10).Text
Dim fecha_S As DateTime = Now()
'Response.Write(fecha_S.ToString("dd/MM/yyy"))
If fecha1 < fecha_S Then
e.Cancel = True
GridView1.Columns.Item(7).Visible = False
MsgBox("No se edita Nota_Pc, Fech_Pc Vencida: " & fecha1)
Else
MsgBox("nota aceptada" & fecha1)
GridView1.EditIndex = e.NewEditIndex
GridView1.Columns.Item(7).Visible = True
End If
If fecha2 < fecha_S Then
e.Cancel = True
GridView1.Columns.Item(9).Visible = False
MsgBox("No se edita Nota_Pc, Fech_Pc Vencida: " & fecha1)
Else
MsgBox("nota aceptada" & fecha1)
GridView1.EditIndex = e.NewEditIndex
GridView1.Columns.Item(9).Visible = True
End If
If fecha3 < fecha_S Then
e.Cancel = True
GridView1.Columns.Item(9).Visible = False
MsgBox("No se edita Nota_Pc, Fech_Pc Vencida: " & fecha1)
Else
MsgBox("nota aceptada" & fecha1)
GridView1.EditIndex = e.NewEditIndex
GridView1.Columns.Item(9).Visible = True
End If
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Page.IsPostBack Then Exit Sub
cargar_grilla()
End Sub