Foros del Web » Programación para mayores de 30 ;) » .NET »

"para Los Tigres"... Sombrear Registros Del Gridview

Estas en el tema de "para Los Tigres"... Sombrear Registros Del Gridview en el foro de .NET en Foros del Web. Hola Se Me Ha Dado La Idea De Hacer Algo Con El Control Gridview, Alguien De Ustedes Sabe "sombrear" Un Registro De X Campo Del ...
  #1 (permalink)  
Antiguo 13/04/2007, 17:37
 
Fecha de Ingreso: agosto-2006
Ubicación: en lima peru
Mensajes: 184
Antigüedad: 17 años, 8 meses
Puntos: 0
"para Los Tigres"... Sombrear Registros Del Gridview

Hola Se Me Ha Dado La Idea De Hacer Algo Con El Control Gridview, Alguien De Ustedes Sabe "sombrear" Un Registro De X Campo Del Gridview ?¿ Lo Que Sucede Es Que No Quiero Hacer Un Filter En Mi Dataview Sino Sombrear X Registro Del Gridview. Alguien Tiene Ideas
  #2 (permalink)  
Antiguo 13/04/2007, 21:16
 
Fecha de Ingreso: agosto-2006
Ubicación: en lima peru
Mensajes: 184
Antigüedad: 17 años, 8 meses
Puntos: 0
Re: "para Los Tigres"... Sombrear Registros Del Gridview

BUENO YA QUE NO HAY NINGUN TIGRE ENTRE USTEDES AQUI LES ENVIO LA SOLUCION
Código:
¡CODE BEHIND
Imports System.Data.SqlClient
Partial Class _Default
    Inherits System.Web.UI.Page
    Dim vista As Data.DataView
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Session("pos") = "NO"
        gvwEmpleado.PageIndex = 0
        gvwEmpleado.DataBind()
        While Session("pos") <> "SI"
            If gvwEmpleado.PageIndex < gvwEmpleado.PageCount - 1 Then
                gvwEmpleado.PageIndex = gvwEmpleado.PageIndex + 1
                enlazar(gvwEmpleado, vista)
                gvwEmpleado.DataBind()
            Else
                Exit While
            End If
        End While
    End Sub
    Public Sub paginar()
        Using con As New SqlConnection _
        ("data source=.\SQLEXPRESS;INTEGRATED SECURITY=TRUE;database=Northwind")
            Using da As New SqlDataAdapter("Select CustomerID,CompanyName,ContactName From Customers", con)
                Dim ds As New Data.DataSet
                da.Fill(ds, "Clientes")
                vista = ds.Tables(0).DefaultView
                Cache("Vista") = vista
                enlazar(gvwEmpleado, vista)
            End Using
        End Using
    End Sub
    Public Sub enlazar(ByVal grd As GridView, ByVal vista As Data.DataView)
        vista = Cache("Vista")
        grd.DataSource = vista
        grd.DataBind()
    End Sub
    Protected Sub gvwEmpleado_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles gvwEmpleado.PageIndexChanging
        gvwEmpleado.PageIndex = e.NewPageIndex
        enlazar(gvwEmpleado, vista)
    End Sub
    Protected Sub gvwEmpleado_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvwEmpleado.RowDataBound
        Dim a As Integer
        For a = 0 To e.Row.Cells.Count - 1
            If UCase(e.Row.Cells(a).Text) = UCase(TextBox1.Text) Then
                e.Row.Cells(a).BackColor = Drawing.Color.Blue
                Session("pos") = "SI"
            End If
        Next
    End Sub
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ' If Not IsPostBack Then
        paginar()
        ' End If

    End Sub
End Class
PAGINA ASPX
Código:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body bgcolor="#0099ff">
    <form id="form1" runat="server">
    <div>
        <div style="text-align: center">
            <table style="width: 440px">
                <tr>
                    <td style="width: 100px">
                        <asp:Label ID="lblTitulo" runat="server" Font-Size="Large" ForeColor="Red" Text="Demo 19: Comando de Seleccion de Varias Filas"
                            Width="405px"></asp:Label></td>
                </tr>
                <tr>
                    <td style="width: 100px">
                        &nbsp;<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                        <asp:Button ID="Button1" runat="server" Text="Button" /></td>
                </tr>
                <tr>
                    <td style="width: 100%">
                        <asp:GridView ID="gvwEmpleado" runat="server" BackColor="#DEBA84" BorderColor="#DEBA84"
                            BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2" AllowPaging="True" style="width: 100%">
                            <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
                            <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
                            <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
                            <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
                            <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
                        </asp:GridView>
                        <br />
                    </td>
                </tr>
                <tr>
                    <td style="width: 100px; height: 21px">
                        <asp:Label ID="lblMensaje" runat="server"></asp:Label></td>
                </tr>
            </table>
        </div>
    
    </div>
    </form>
</body>
</html>
  #3 (permalink)  
Antiguo 04/04/2010, 16:35
 
Fecha de Ingreso: abril-2010
Mensajes: 1
Antigüedad: 14 años, 1 mes
Puntos: 0
Respuesta: "para Los Tigres"... Sombrear Registros Del Gridview

Tienes el código para C# ???
Me sería de mucha utilidad.
Gracias
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:57.