Foro de elhacker.net

Programación => .NET (C#, VB.NET, ASP) => Mensaje iniciado por: jorgexl30 en 2 Noviembre 2009, 13:43 pm



Título: [SOLUCIONADO] Problemas con GridView al filtrar datos
Publicado por: jorgexl30 en 2 Noviembre 2009, 13:43 pm
Hola de nuevo al foro  estoy con un preblema necesito que me muestre cierta imagen una columna si se cumple una condicion uy otra imagen si se cumple otra condicion luego si esa condicion contien un valor x me deje deaabilitado una fila de otra columna
mmm se puede hacer ....

gracias de antemano  :huh:

asi  lleno el gridview

 Dim conexión As New SqlConnection(WebConfigurationManager.ConnectionStrings("LocalSqlServer").ConnectionString)
        Dim consulta As New SqlCommand("select CODCARR, CODPESTUD,nombre_c from  matricula.mt_carrer where codcarr='" & Trim(Request.QueryString("carrera")) & "'", conexión)
        conexión.Open()
        buscar = consulta.ExecuteReader()
        Do While buscar.Read()
            codpestud = buscar("codpestud")
            titulo = buscar("nombre_c")
        Loop
        buscar.Close()
        Dim consultar As New SqlCommand("SELECT  RAMO.HORAS_PLAN AS [HORAS PLAN],RAMO.CODRAMO, RAMO.NOMBRE,CURRIC.CODPESTUD,ramo.periodo FROM matricula.RA_RAMO RAMO, matricula.RA_CURRIC CURRIC WHERE (CURRIC.CODPESTUD='" & codpestud.ToString() & "')AND RAMO.CODRAMO = CURRIC.CODRAMO order by codramo", conexión)
        Dim adapter As New SqlDataAdapter()
        adapter.SelectCommand = consultar
        Dim dataset As New DataSet
        adapter.Fill(dataset, "RA_curric,RA_RAMO")
        conexión.Close()
        GridView1.DataSource = dataset
        GridView1.DataBind()


Título: Re: Problemas con GridView al filtrar datos
Publicado por: jorgexl30 en 2 Noviembre 2009, 20:32 pm
hola  lo solucione asiqye les dejo el codigo por si les sirve

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
            If e.Row.Cells(5).Text = 2 Then
                e.Row.Cells(4).BackColor = Color.Green
                ' e.Row.Cells(4).ForeColor = Color.Black

                e.Row.Cells(4).Enabled = False

            Else
                e.Row.Cells(4).BackColor = Color.Yellow
            End If

        End If



    End Sub
;-)