Imports DevExpress.Web
Imports DevExpress.XtraPrinting
Imports DevExpress.Export

Public Class ucConcursosFiltros
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'cmbEstado.SelectedIndex = 1
        If Not IsPostBack Then
            gridPuestosPublicados.FilterExpression = "idEstadoPlaza=2"
        End If

    End Sub

    Protected Sub gridPuestosPublicados_HtmlDataCellPrepared(sender As Object, e As DevExpress.Web.ASPxGridViewTableDataCellEventArgs) Handles gridPuestosPublicados.HtmlDataCellPrepared
        Dim btn As ASPxButton = gridPuestosPublicados.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "btnAplicar")
        If Not btn Is Nothing Then
            btn.ClientSideEvents.Click = String.Format("function(s, e) {{OnMoreInfoClick('{0}');}}", e.KeyValue)
        End If
        Dim btn2 As ASPxButton = gridPuestosPublicados.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "btnProceso")
        If Not btn2 Is Nothing Then
            btn2.ClientSideEvents.Click = String.Format("function(s, e) {{Proceso('{0}');}}", e.KeyValue)
        End If
        If e.DataColumn.FieldName = "siglasInstitucion" Then
            If Not String.IsNullOrEmpty(e.CellValue) Then
                e.Cell.ToolTip = gridPuestosPublicados.GetRowValues(e.VisibleIndex, "nombreInstitucion").ToString
            End If
        End If
    End Sub

    Protected Sub ASPxButton1_Click(sender As Object, e As EventArgs) Handles ASPxButton1.Click
        gridPuestosPublicados.Columns("accion").Visible = False
        'gridPuestosPublicados.DataBind()
        gridExport.WriteXlsxToResponse(New XlsxExportOptionsEx With {.ExportType = ExportType.WYSIWYG})
    End Sub
End Class