Files
SIG/Prospectos/RepPadronDetalle.aspx.vb
JORGE LUIS CAUDILLO ESPARZA c35cf91883 Commit inicial Ventas Productivo
2019-08-14 16:40:54 -07:00

58 lines
2.1 KiB
VB.net

Option Explicit On
Option Strict On
Imports System.Data
Imports Extensiones
Partial Class Prospectos_RepPadronDetalle
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.GetRepPadronDetalle() Then
ViewState("DTProspectos") = 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
End Sub
Private Sub CargaGrid(Orden As String)
If Orden <> String.Empty Then
Dim DV As New DataView(CType(ViewState("DTProspectos"), DataTable), "", Orden, DataViewRowState.CurrentRows)
GvDatos.DataSource = DV.ToTable()
DV.Dispose()
Else
GvDatos.DataSource = CType(ViewState("DTProspectos"), DataTable)
End If
GvDatos.DataBind()
End Sub
Protected Sub ImgExcel_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles ImgExcel.Click
GvDatos.ExportToExcel("PadronDetalle")
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
End Class