Option Explicit On Option Strict On Imports System.Data Imports Extensiones Partial Class Prospectos_RepEventosDetalle Inherits ClsPaginas Private Property CveEvento As Integer Get Return ViewState("CveEvento").ToString.ToEntero End Get Set(value As Integer) ViewState("CveEvento") = value End Set End Property Private Property CveEventoTipo As Integer Get Return ViewState("CveEventoTipo").ToString.ToEntero End Get Set(value As Integer) ViewState("CveEventoTipo") = value End Set End Property Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then CveEvento = IfNull(Request("CveEvento"), "0").ToString.ToEntero() CveEventoTipo = IfNull(Request("CveEventoTipo"), "-1").ToString.ToEntero() ViewState("Orden") = String.Empty CargaDatos() End If End Sub Public Sub CargaDatos() Dim ObjProspectos As New ClsProspectos If ObjProspectos.GetRepEventosDetalle(CveEvento, CveEventoTipo) Then ViewState("DTEventosDetalle") = ObjProspectos.DtResultados Else Me.GvDatos.DataSource = Nothing End If ObjProspectos.Dispose() If ViewState("Orden").ToString() <> String.Empty Then CargaGrid(ViewState("Orden").ToString()) Else CargaGrid("") End If LtlNumRegistros.Text = GvDatos.Rows.Count.ToString.FormatoNumero(0) UPDatos.Update() End Sub Private Sub CargaGrid(Orden As String) If Orden <> String.Empty Then Dim DV As New DataView(CType(ViewState("DTEventosDetalle"), DataTable), "", Orden, DataViewRowState.CurrentRows) GvDatos.DataSource = DV.ToTable() DV.Dispose() Else GvDatos.DataSource = CType(ViewState("DTEventosDetalle"), DataTable) End If GvDatos.DataBind() End Sub Protected Sub GvDatos_RowCreated(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GvDatos.RowCreated If (e.Row.RowType = DataControlRowType.DataRow AndAlso (e.Row.RowState = DataControlRowState.Normal OrElse e.Row.RowState = DataControlRowState.Alternate)) Then e.Row.TabIndex = -1 e.Row.Attributes("onclick") = String.Format("javascript:SelectRow(this, {0});", e.Row.RowIndex) e.Row.Attributes("onkeydown") = "javascript:return SelectSibling(event);" e.Row.Attributes("onselectstart") = "javascript:return false;" 'e.Row.Cells(10).Attributes.Add("onclick", "EC();") End If End Sub 'Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound ' If e.Row.RowType = DataControlRowType.DataRow Then ' If e.Row.RowIndex = 0 Then ' e.Row.CssClass = "Totales" ' e.Row.FCLiteral("LtlEvento").Text = "Total General" ' End If ' If e.Row.DBCampo("EventoTipo") <> String.Empty AndAlso e.Row.DBCampo("Municipio") = String.Empty Then ' e.Row.CssClass = "SubTotales2" ' e.Row.FCLiteral("LtlEvento").Text = "  Evento: " & e.Row.DBCampo("EventoTipo") ' ' e.Row.Cells(1).Visible = False : e.Row.Cells(0).ColumnSpan = 2 ' ElseIf e.Row.DBCampo("EventoTipo") <> String.Empty AndAlso e.Row.DBCampo("Municipio") <> String.Empty AndAlso e.Row.DBCampo("Evento") = String.Empty Then ' e.Row.CssClass = "SubTotales" ' e.Row.FCLiteral("LtlEvento").Text = "    Municipio: " & e.Row.DBCampo("Municipio") ' ' e.Row.Cells(1).Visible = False : e.Row.Cells(0).ColumnSpan = 2 ' ElseIf e.Row.DBCampo("EventoTipo") <> String.Empty AndAlso e.Row.DBCampo("Municipio") <> String.Empty AndAlso e.Row.DBCampo("Evento") <> String.Empty Then ' 'e.Row.CssClass = "Texto" ' e.Row.FCLiteral("LtlEvento").Text = "      " & e.Row.DBCampo("Evento") ' Dim Liga As String = String.Format("", e.Row.DBCampo("CveEvento")) ' 'e.Row.FCLiteral("LtlEvento").Text = Liga & e.Row.FCLiteral("LtlEvento").Text & "" ' e.Row.FCLiteral("LtlNumAsistentes").Text = Liga & e.Row.FCLiteral("LtlNumAsistentes").Text & "" ' e.Row.FCLiteral("LtlFechaEvento").Text = Liga & e.Row.FCLiteral("LtlFechaEvento").Text & "" ' End If ' e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left ' e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Center ' End If 'End Sub Protected Sub ImgExcel_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles ImgExcel.Click GvDatos.ExportToExcel("RepEventosDetalle") End Sub End Class