Option Explicit On Option Strict On Imports System.Data Imports Extensiones Partial Class Prospectos_RepEventos Inherits ClsPaginas Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then ViewState("Orden") = String.Empty CargaDatos() End If End Sub Public Sub CargaDatos() Dim ObjProspectos As New ClsProspectos If ObjProspectos.GetRepEventos Then ViewState("DTEventos") = 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 UPDatos.Update() End Sub Private Sub CargaGrid(Orden As String) If Orden <> String.Empty Then Dim DV As New DataView(CType(ViewState("DTEventos"), DataTable), "", Orden, DataViewRowState.CurrentRows) GvDatos.DataSource = DV.ToTable() DV.Dispose() Else GvDatos.DataSource = CType(ViewState("DTEventos"), 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 BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click ' CargaDatos() ' UPDatos.Update() ' RegistraScript("UpperBound = " & GvDatos.Rows.Count - 1 & ";") 'End Sub Protected Sub ImgExcel_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles ImgExcel.Click GvDatos.ExportToExcel("RepEventos") End Sub End Class