This is a migrated thread and some comments may be shown as answers.

Duplicated AjaxRequest are invalidating the execution of a RadDock

3 Answers 103 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Rafaga2k
Top achievements
Rank 1
Rafaga2k asked on 10 Dec 2010, 09:54 PM
Hi telerik gurus ... i'm almost new to this components and i'm learning a lot

i'll try to explain my problem in the easiest way possible

background
  1. all code in grids are execution-time and the structure and declaration in Page_init method (zero design-mode)
  2. using masterpage / contentpage and using an ajaxmanager
  3.  i'm using 2 grids in a multipage control (one using a checkbox template row, and the another using radiobutton as template row) both of them using a radtoolbar inserted in the grid
  4. in the radiobutton's one is ajaxified and i'm using a RadDock to simulate an external edit of my row (the later one inserted into a ajaxpanel)
  5. i'm using javascript to manage my radiobuttons and to display the RadDock
Everything is almost fine but a bug is pissing me:

the problem is in the Radgrid with RadioButtons . in that radgrid the toolbar has 3 buttons (New, Edit and Delete) the 2 first buttons calls the RadDock. When i press the first time the new or edit button the Raddock shows and data is displayed as i want but when close the dock and try to do the same operation the dock is not displayed aparently the second and successive times that i press button ; the event generate 2 AjaxRequest for each button (one the both aborted by the later one) and thats generate the problem

the first time i press the buttons only do 1 Ajax Request.

I'm glad to provide more information if needed

VB code behind

Imports mnlib
Imports System.Data
Imports System.Data.OleDb
Imports System.IO
Imports adquisiciones
 
Partial Public Class Proceso
    Inherits System.Web.UI.Page
    Protected oConn As Connection
    Protected oDts As DataSet
    Protected oProc As abProceso
    Protected oLSer As LosFormatter
    Protected WithEvents grdCalendario As Telerik.Web.UI.RadGrid
    Protected WithEvents grdSolpedPos As Telerik.Web.UI.RadGrid
    Protected WithEvents tbSol As tbGridProceso
    Protected WithEvents tbCal As tbGridCalendario
    Protected WithEvents oColChk As grdChkTemplate
    Protected WithEvents oColRadio As grdRadioTemplate
 
#Region "Propiedades"
    Private ReadOnly Property ChkSolped() As Hashtable
        Get
            Dim res As Object = ViewState("_csp0")
            If (res Is Nothing) Then
                res = New Hashtable
                ViewState("_csp0") = res
            End If
            Return CType(res, Hashtable)
        End Get
    End Property
 
    Private ReadOnly Property ChkSolpedPos() As Hashtable
        Get
            Dim res As Object = ViewState("_csp1")
            If (res Is Nothing) Then
                res = New Hashtable
                ViewState("_csp1") = res
            End If
            Return CType(res, Hashtable)
        End Get
    End Property
#End Region
 
    Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        Me.oConn = New Connection(System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~"))
        oDts = New DataSet("datos")
        adquisiciones.Catalogos.getTipoProceso(oConn, oDts)
        adquisiciones.Catalogos.getResponsables(oConn, oDts)
        adquisiciones.Catalogos.getTipoSubProceso(oConn, oDts)
        adquisiciones.Catalogos.getRazonPrioridad(oConn, oDts)
        adquisiciones.Catalogos.getSolpeds(oConn, oDts)
        Intranet.Catalogos.getEspecialidad(oConn, oDts)
        '******* recreacion de la estructura en este punto es necesario segun TELERIK ***********
        Me.restoreSolPosCampos()
        Me.restoreCalCampos()
        Me.phGrdCal.Controls.Add(Me.grdCalendario)
        Me.phGrdSolPos.Controls.Add(Me.grdSolpedPos)
        '****************************************************************************************
    End Sub
 
    Private Sub FillComponents()
        If Not IsNothing(oProc) Then
            Me.txtImporte.Text = Me.oProc.importe
            Me.txtNomEvento.Text = Me.oProc.concepto
            Me.cmbResp.SelectedValue = Me.oProc.responsable
            Me.cmbTipEvento.SelectedValue = Me.oProc.tipo
            Me.cmbPrioridad.SelectedValue = Me.oProc.prioridad
            Me.cmbRazon.SelectedValue = Me.oProc.razonPrioridad
            Me.cmbEspecialidad.SelectedValue = Me.oProc.especialidad
        End If
    End Sub
 
    Protected Sub grdLista_DetailTableDataBind(ByVal source As Object, ByVal e As Telerik.Web.UI.GridDetailTableDataBindEventArgs) Handles grdSolpedPos.DetailTableDataBind
        Dim a As String = ""
        Dim oVw As DataView
        Dim parentItem As Telerik.Web.UI.GridDataItem = CType(e.DetailTableView.ParentItem, Telerik.Web.UI.GridDataItem)
        Select Case e.DetailTableView.Name
            Case "SolpedPosicion"
                'e.DetailTableView.DataSource = Nothing
                oVw = New DataView(oDts.Tables("SolpedPosicion"), " num_solped='" & parentItem.GetDataKeyValue("num_solped").ToString() & "'", "", DataViewRowState.OriginalRows)
                e.DetailTableView.DataSource = oVw
        End Select
    End Sub
 
    Protected Sub grdLista_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles grdSolpedPos.NeedDataSource
        If Not e.IsFromDetailTable Then
            'restoreProcCampos()
            Me.grdSolpedPos.MasterTableView.DataSource = oDts.Tables("Solped")
            Me.grdSolpedPos.MasterTableView.Name = oDts.Tables("Solped").TableName
            If Not Page.IsPostBack Then
                restoreChkViewStateData()
            End If
        End If
    End Sub
 
    Protected Sub grdCalendario_CheckChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim oData As Telerik.Web.UI.GridDataItem
        oData = DirectCast(DirectCast(sender, RadioButton).NamingContainer, Telerik.Web.UI.GridDataItem)
        Me.hdnIds.Value = oData("cve_subproceso").Text.ToString() & "_" & oData("num_subproceso").Text.ToString()
    End Sub
 
    Private Sub restoreCalCampos()
        Dim oDgr As Telerik.Web.UI.GridBoundColumn
        Dim cont As Integer
        Dim bVacio As Boolean = True
        Dim oCTmp As Telerik.Web.UI.GridTemplateColumn
 
        Me.grdCalendario = New Telerik.Web.UI.RadGrid()
        Me.grdCalendario.ID = "grdCalendario"
        Me.grdCalendario.AllowFilteringByColumn = False
        Me.grdCalendario.AllowMultiRowSelection = False
        Me.grdCalendario.AutoGenerateColumns = False
        Me.grdCalendario.AllowPaging = True
        Me.grdCalendario.AllowSorting = True
        Me.grdCalendario.GridLines = GridLines.Both
        Me.grdCalendario.MasterTableView.CommandItemDisplay = Telerik.Web.UI.GridCommandItemDisplay.Top
        Me.grdCalendario.PagerStyle.Mode = Telerik.Web.UI.GridPagerMode.NextPrevAndNumeric
        'Me.grdCalendario.
 
        If Me.grdCalendario.Columns.Count > 0 Then
            bVacio = False
        Else
            bVacio = True
        End If
        For cont = 0 To 9
            If bVacio Then
                oDgr = New Telerik.Web.UI.GridBoundColumn()
            Else
                oDgr = Me.grdCalendario.Columns(cont)
            End If
            Select Case cont
                Case 0
                    oDgr.DataField = "num_proceso"
                    oDgr.HeaderText = "# Proceso"
                    oDgr.DataType = GetType(Long)
                    oDgr.Visible = False
                Case 1
                    oDgr.DataField = "num_subproceso"
                    oDgr.HeaderText = "# Subproceso"
                    oDgr.DataType = GetType(Long)
                    oDgr.Visible = False
                Case 2
                    oDgr.DataField = "cve_subproceso"
                    oDgr.HeaderText = "Tipo SubProceso"
                    oDgr.DataType = GetType(String)
                Case 3
                    oDgr.DataField = "titulo"
                    oDgr.HeaderText = "Titulo"
                    oDgr.DataType = GetType(String)
                Case 4
                    oDgr.DataField = "descripcion"
                    oDgr.HeaderText = "Descripcion"
                    oDgr.DataType = GetType(String)
                Case 5
                    oDgr.DataField = "fecProgIni"
                    oDgr.HeaderText = "Inicio"
                    oDgr.DataType = GetType(DateTime)
                Case 6
                    oDgr.DataField = "fecProgFin"
                    oDgr.HeaderText = "Fin"
                    oDgr.DataType = GetType(DateTime)
                Case 7
                    oDgr.DataField = "fecRealIni"
                    oDgr.HeaderText = "Fecha Inicial(Real)"
                    oDgr.DataType = GetType(DateTime)
                    oDgr.Visible = False
                Case 8
                    oDgr.DataField = "fecRealFin"
                    oDgr.HeaderText = "Fecha Final(Real)"
                    oDgr.DataType = GetType(DateTime)
                    oDgr.Visible = False
                Case 9
                    oDgr.DataField = "responsable"
                    oDgr.HeaderText = "Responsable"
                    oDgr.DataType = GetType(String)
            End Select
            If bVacio Then
                Me.grdCalendario.Columns.Add(oDgr)
            End If
        Next
        '********************* Adicion de RadioButtons ***********************
        '********************* Creacion RadioButtons ***************************
        Me.oColRadio = New grdRadioTemplate()
        oCTmp = New Telerik.Web.UI.GridTemplateColumn()
        oCTmp.ItemTemplate = Me.oColRadio
        oCTmp.HeaderText = ""
        oCTmp.UniqueName = "Rad"
        oCTmp.ReadOnly = False
        Me.grdCalendario.MasterTableView.Columns.AddAt(0, oCTmp)
        '*******************************************************************
        '************ Generar Toolbar *************
        Me.tbCal = New tbGridCalendario()
        Me.grdCalendario.MasterTableView.CommandItemTemplate = Me.tbCal
        'Me.grdCalendario.Rebind()
    End Sub
 
    Private Sub restoreSolPosCampos()
        Dim oDgr As Telerik.Web.UI.GridBoundColumn
        Dim oVw As Telerik.Web.UI.GridTableView
        Dim oGrf As Telerik.Web.UI.GridRelationFields
        Dim cont As Integer
        Dim bVacio As Boolean = True
        Dim oCTmp As Telerik.Web.UI.GridTemplateColumn
 
        Me.grdSolpedPos = New Telerik.Web.UI.RadGrid()
        Me.grdSolpedPos.ID = "grdSolpedPos"
        Me.grdSolpedPos.AllowFilteringByColumn = False
        Me.grdSolpedPos.MasterTableView.AutoGenerateColumns = False
        Me.grdSolpedPos.MasterTableView.CommandItemDisplay = Telerik.Web.UI.GridCommandItemDisplay.Top
        Me.grdSolpedPos.AllowPaging = True
        Me.grdSolpedPos.AllowSorting = True
        Me.grdSolpedPos.GridLines = GridLines.Both
        Me.grdSolpedPos.PagerStyle.Mode = Telerik.Web.UI.GridPagerMode.NextPrevAndNumeric
        'Me.grdSolpedPos.PagerStyle.Position = Telerik.Web.UI.GridPagerPosition.TopAndBottom
 
        oVw = New Telerik.Web.UI.GridTableView()
        Me.grdSolpedPos.MasterTableView.Columns.Clear()
        For cont = 0 To 6
            oDgr = New Telerik.Web.UI.GridBoundColumn()
            Select Case cont
                Case 0
                    oDgr.DataField = "num_solped"
                    oDgr.HeaderText = "Solped"
                    oDgr.DataType = GetType(Long)
                    oDgr.ReadOnly = True
                Case 1
                    oDgr.DataField = "importe"
                    oDgr.HeaderText = "Importe"
                    oDgr.DataType = GetType(Double)
                    oDgr.Visible = False
                    oDgr.ReadOnly = True
                Case 2
                    oDgr.DataField = "concepto"
                    oDgr.HeaderText = "Concepto"
                    oDgr.DataType = GetType(String)
                    oDgr.ReadOnly = True
                Case 3
                    oDgr.DataField = "creado"
                    oDgr.HeaderText = "Creado por"
                    oDgr.DataType = GetType(String)
                    oDgr.ReadOnly = True
                Case 4
                    oDgr.DataField = "cve_documento"
                    oDgr.HeaderText = "Clave Doc."
                    oDgr.DataType = GetType(String)
                    oDgr.ReadOnly = True
                    oDgr.Visible = False
                Case 5
                    oDgr.DataField = "solicitante"
                    oDgr.HeaderText = "Solicitante"
                    oDgr.DataType = GetType(String)
                    oDgr.ReadOnly = True
                Case 6
                    oDgr.DataField = "CentroGestor"
                    oDgr.HeaderText = "Centro Gestor"
                    oDgr.DataType = GetType(String)
                    oDgr.ReadOnly = True
                    oDgr.Visible = False
            End Select
            Me.grdSolpedPos.MasterTableView.Columns.Add(oDgr)
        Next
        '********************* Adicion de ChackBoxes ***********************
        '********************* Creacion CheckBox ***************************
        Me.oColChk = New grdChkTemplate()
        oCTmp = New Telerik.Web.UI.GridTemplateColumn()
        oCTmp.ItemTemplate = Me.oColChk
        oCTmp.HeaderText = ""
        oCTmp.UniqueName = "ChkAll"
        oCTmp.ReadOnly = False
        Me.grdSolpedPos.MasterTableView.Columns.AddAt(0, oCTmp)
        '*******************************************************************
        Me.grdSolpedPos.MasterTableView.DataKeyNames = New String() {"num_solped"}
        Me.grdSolpedPos.MasterTableView.HierarchyLoadMode = Telerik.Web.UI.GridChildLoadMode.ServerOnDemand
        Me.grdSolpedPos.MasterTableView.DetailTables.Clear()
        Me.grdSolpedPos.MasterTableView.EditMode = Telerik.Web.UI.GridEditMode.InPlace
        Me.grdSolpedPos.AllowMultiRowEdit = True
        oVw.DataSource = oDts.Tables("SolpedPosicion")
        oVw.DataKeyNames = New String() {"num_solped", "pos_solped"}
        oGrf = New Telerik.Web.UI.GridRelationFields()
        oGrf.MasterKeyField = "num_solped"
        oGrf.DetailKeyField = "num_solped"
        oVw.ParentTableRelation.Add(oGrf)
        oVw.Name = oDts.Tables("SolpedPosicion").TableName
        oVw.Columns.Clear()
        oVw.AutoGenerateColumns = False
        Me.grdSolpedPos.MasterTableView.DetailTables.Add(oVw)
        For cont = 0 To 6
            oDgr = New Telerik.Web.UI.GridBoundColumn()
            Select Case cont
                Case 0
                    oDgr.DataField = "num_solped"
                    oDgr.HeaderText = "Solped"
                    oDgr.DataType = GetType(Long)
                    oDgr.ReadOnly = True
                    oDgr.Visible = False
                Case 1
                    oDgr.DataField = "pos_solped"
                    oDgr.HeaderText = "Posicion"
                    oDgr.DataType = GetType(Integer)
                    oDgr.ReadOnly = True
                Case 2
                    oDgr.DataField = "pedido"
                    oDgr.HeaderText = "pedido"
                    oDgr.DataType = GetType(Double)
                    oDgr.ReadOnly = True
                Case 3
                    oDgr.DataField = "creado"
                    oDgr.HeaderText = "Creado por"
                    oDgr.DataType = GetType(String)
                    oDgr.ReadOnly = True
                    oDgr.Visible = False
                Case 4
                    oDgr.DataField = "descripcion_breve"
                    oDgr.HeaderText = "Descripcion"
                    oDgr.DataType = GetType(String)
                    oDgr.ReadOnly = True
                Case 5
                    oDgr.DataField = "cantidad"
                    oDgr.HeaderText = "Cantidad"
                    oDgr.DataType = GetType(Double)
                    oDgr.ReadOnly = True
                Case 6
                    oDgr.DataField = "fechaSolicitud"
                    oDgr.HeaderText = "Solicitado"
                    oDgr.DataType = GetType(DateTime)
                    oDgr.ReadOnly = True
                    oDgr.Visible = False
            End Select
            Me.grdSolpedPos.MasterTableView.DetailTables(0).Columns.Add(oDgr)
        Next
        '********************* Adicion de CheckBoxes ***********************
        Me.oColChk = New grdChkTemplate()
        oCTmp = New Telerik.Web.UI.GridTemplateColumn()
        oCTmp.ItemTemplate = Me.oColChk
        oCTmp.HeaderText = ""
        oCTmp.UniqueName = "Chk"
        oCTmp.ReadOnly = False
        Me.grdSolpedPos.MasterTableView.DetailTables(0).Columns.AddAt(0, oCTmp)
        '*******************************************************************
        '************ Generar Toolbar *************
        Me.tbSol = New tbGridProceso()
        Me.grdSolpedPos.MasterTableView.CommandItemTemplate = Me.tbSol
    End Sub
 
    Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Me.realoadProc()
        If Not Page.IsPostBack Then
            Me.FillComponents()
            Me.cmbTipEvento.DataSource = oDts.Tables("TipoProceso")
            Me.cmbTipEvento.DataTextField = "descripcion"
            Me.cmbTipEvento.DataValueField = "cve_proceso"
            Me.cmbTipEvento.DataBind()
            Me.cmbResp.DataSource = oDts.Tables("Responsable")
            Me.cmbResp.DataTextField = "nombrecompleto"
            Me.cmbResp.DataValueField = "rpe"
            Me.cmbResp.DataBind()
            Me.cmbRazon.DataSource = oDts.Tables("RazonPrioridad")
            Me.cmbRazon.DataTextField = "descripcion"
            Me.cmbRazon.DataValueField = "cve_razonPrior"
            Me.cmbRazon.DataBind()
            Me.cmbEspecialidad.DataSource = oDts.Tables("Especialidad")
            Me.cmbEspecialidad.DataTextField = "nombre"
            Me.cmbEspecialidad.DataValueField = "abreviacion"
            Me.cmbEspecialidad.DataBind()
            Me.cmbSubProceso.DataSource = oDts.Tables("TipoSubProceso")
            Me.cmbSubProceso.DataTextField = "descripcion"
            Me.cmbSubProceso.DataValueField = "cve_subproceso"
            Me.cmbSubProceso.DataBind()
            Me.cmbRespEvento.DataSource = oDts.Tables("Responsable")
            Me.cmbRespEvento.DataTextField = "nombrecompleto"
            Me.cmbRespEvento.DataValueField = "rpe"
            Me.cmbRespEvento.DataBind()
        End If
        If RadAjaxManager1.AjaxSettings.Count = 0 Then
            Me.RadAjaxManager1.AjaxSettings.AddAjaxSetting(Me.grdCalendario, Me.grdCalendario)
            Me.RadAjaxManager1.AjaxSettings.AddAjaxSetting(Me.grdCalendario, Me.RadDock1)
            Me.RadAjaxManager1.AjaxSettings.AddAjaxSetting(Me.grdCalendario, Me.cmbSubProceso)
            Me.RadAjaxManager1.AjaxSettings.AddAjaxSetting(Me.grdCalendario, Me.cmbRespEvento)
            Me.RadAjaxManager1.AjaxSettings.AddAjaxSetting(Me.grdCalendario, Me.dpFecIni)
            Me.RadAjaxManager1.AjaxSettings.AddAjaxSetting(Me.grdCalendario, Me.dpFecFin)
            Me.RadAjaxManager1.AjaxSettings.AddAjaxSetting(Me.grdCalendario, Me.txtSPDesc)
        End If
    End Sub
 
    Protected Sub Grid_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles grdSolpedPos.ItemCommand, grdCalendario.ItemCommand
        Dim oStr As String() = {"", ""}
        Select Case e.CommandName
            Case "DelSolPos"
                oStr(0) = e.Item.Cells(3).Text
                oStr(1) = e.Item.Cells(4).Text
                Me.oProc.Posiciones.Remove(Me.oProc.Posiciones.GetElementByName(oStr))
                Me.grdSolpedPos.Rebind()
            Case "DelCal"
                oStr(0) = e.Item.Cells(4).Text
                oStr(1) = e.Item.Cells(3).Text
                Me.oProc.Calendario.Remove(Me.oProc.Calendario.GetElementByName(oStr))
                Me.grdCalendario.Rebind()
            Case "cmdGuardar"
                If Not IsNothing(oConn) Then
                    If IsNothing(Me.oProc) Then
                        Me.oProc = New abProceso(Me.oConn.Clone())
                    Else
                        Me.oProc.Conexion = Me.oConn.Clone()
                    End If
                    Me.oProc.importe = Me.txtImporte.Value
                    Me.oProc.concepto = Me.txtNomEvento.Text
                    Me.oProc.responsable = Me.cmbResp.SelectedValue
                    'Me.cmbRespEvento.SelectedValue = Me.cmbResp.SelectedValue
                    Me.oProc.moneda = "MXN"
                    Me.oProc.tipo = Me.cmbTipEvento.SelectedValue
                    Me.oProc.razonPrioridad = Me.cmbRazon.SelectedValue
                    Me.oProc.prioridad = Me.cmbPrioridad.SelectedValue
                    Me.oProc.especialidad = Me.cmbEspecialidad.SelectedValue
                    If Not IsNothing(Request.QueryString.GetValues("id")) Then
                        If Request.QueryString("id") = oProc.numero Then
                            Me.oProc.UpdateData()
                        Else
                            Me.oProc.insertData()
                        End If
                    Else
                        Me.oProc.insertData()
                    End If
                    saveChkViewStateData()
                    oLSer = New LosFormatter()
                    Dim oSw As New StringWriter()
                    oLSer.Serialize(oSw, Me.oProc)
                    ViewState("prc" & Session("guid")) = oSw.ToString()
                    If oTabMan.Tabs(1).Enabled = False Then
                        oTabMan.Tabs(1).Enabled = True
                    End If
                    grdSolpedPos.Rebind()
                End If
            Case "cmdReset"
                'If Not IsNothing() Then
                grdSolpedPos.Rebind()
                'End If
            Case "cmdNew"
                Me.hdnAction.Value = "n"
                CargarEvento()
                ScriptManager.RegisterStartupScript(Page, [GetType](), "openForm", "Sys.Application.add_load(openForm);", True)
            Case "cmdEdit"
                Me.hdnAction.Value = "e"
                CargarEvento()
                ScriptManager.RegisterStartupScript(Page, [GetType](), "openForm", "Sys.Application.add_load(openForm);", True)
            Case "cmdDelete"
                Me.hdnAction.Value = "d"
                RadAjaxManager1.ResponseScripts.Add("confirm('hola','¿Desea realmente eliminar este evento?');")
                'RadAjaxManager1.Alert("hola")
                'ScriptManager.RegisterStartupScript(Page, [GetType](), "radalert", "window.radalert('Welcome to Rad<b>window</b>!', 330, 210);", True)
        End Select
    End Sub
 
    Protected Sub grdCalendario_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles grdCalendario.NeedDataSource
        Dim oVw As DataView
        If IsNothing(oProc) Then
            Me.grdCalendario.DataSource = Nothing
        Else
            adquisiciones.Catalogos.getProcesoCalendario(oConn, oDts)
            oVw = New DataView(oDts.Tables("ProcesoCalendario"), "num_proceso='" & Me.oProc.numero & "'", "", DataViewRowState.OriginalRows)
            Me.grdCalendario.DataSource = oVw
        End If
    End Sub
 
    Protected Sub realoadProc()
        Dim oSr As StringReader
        Dim oLser As New LosFormatter()
        If IsNothing(Me.oProc) Then
            If Not IsNothing(ViewState("prc" & Session("guid"))) Then
                oSr = New StringReader(ViewState("prc" & Session("guid")))
                Me.oProc = oLser.Deserialize(oSr)
                Me.oProc.Conexion = oConn
            Else
                If Not IsNothing(Request.QueryString.Item("id")) Then
                    oProc = New abProceso(oConn, CInt(Request.QueryString("id")))
                    Me.oTabMan.Tabs(1).Enabled = True
                End If
            End If
        End If
    End Sub
 
    Protected Sub grdSolpedPos_CheckChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim box As CheckBox = CType(sender, CheckBox)
        Dim item As Telerik.Web.UI.GridDataItem = CType(box.NamingContainer, Telerik.Web.UI.GridDataItem)
        Dim sID As String = ""
        Dim i As Integer
        Dim oSol As adquisiciones.abSolped
        Dim target As Hashtable = Nothing
 
        If (item.OwnerTableView.Name = "Solped") Then
            target = ChkSolped()
            sID = item.GetDataKeyValue("num_solped").ToString()
        Else
            target = ChkSolpedPos()
            sID = item.GetDataKeyValue("num_solped").ToString() & "_" & item.GetDataKeyValue("pos_solped").ToString()
        End If
 
        If box.Checked Then
            target(sID) = True
        Else
            target(sID) = Nothing
        End If
        ' **************** ASIGNACION DE CHECK A DESCENDIENTES ***********************
        If item.OwnerTableView.Name = "Solped" And box.Checked Then
            oSol = New adquisiciones.abSolped(Me.oConn, sID)
            target = ChkSolpedPos()
            If oSol.posiciones.Count > 0 Then
                For i = 0 To oSol.posiciones.Count - 1
                    If oSol.posiciones(i).NumeroPedido = 0 Then
                        target(oSol.Clave & "_" & oSol.posiciones(i).PosicionSolped.ToString()) = True
                    End If
                Next
                'Me.grdSolpedPos
            End If
        End If
 
        'If item.OwnerTableView.Name = "SolpedPosicion" Then
        '    oSol = New adquisiciones.abSolped(Me.oConn, sID)
        '    target = ChkSolpedPos()
        '    If oSol.posiciones.Count > 0 Then
        '        For i = 0 To oSol.posiciones.Count - 1
        '            If oSol.posiciones(i).NumeroPedido = 0 Then
        '                target(oSol.Clave & "_" & oSol.posiciones(i).PosicionSolped.ToString()) = True
        '            End If
        '        Next
        '    End If
        'End If
 
    End Sub
 
    Private Sub grdSolpedPos_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles grdSolpedPos.ItemDataBound
        If TypeOf e.Item Is Telerik.Web.UI.GridDataItem Then
            Dim item As Telerik.Web.UI.GridDataItem = CType(e.Item, Telerik.Web.UI.GridDataItem)
            Dim box As CheckBox = CType(item.FindControl("oChk"), CheckBox)
            Dim isChecked As Object = Nothing
 
            Select Case item.OwnerTableView.Name
                Case "Solped"
                    isChecked = ChkSolped(item.GetDataKeyValue("num_solped").ToString())
                Case "SolpedPosicion"
                    isChecked = ChkSolpedPos(item.GetDataKeyValue("num_solped").ToString() & "_" & item.GetDataKeyValue("pos_solped").ToString())
            End Select
            If Not (isChecked Is Nothing) Then
                box.Checked = CType(isChecked, Boolean)
            End If
        End If
    End Sub
 
    Private Sub oGrid_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles grdSolpedPos.ItemCreated, grdCalendario.ItemCreated
        If e.Item.ItemType = Telerik.Web.UI.GridItemType.Item Or e.Item.ItemType = Telerik.Web.UI.GridItemType.AlternatingItem Then
            Select Case sender.ID
                Case "grdSolpedPos"
                    Dim oChk As CheckBox = CType(e.Item.FindControl("oChk"), CheckBox)
                    If Not IsNothing(oChk) Then
                        AddHandler oChk.CheckedChanged, AddressOf Me.grdSolpedPos_CheckChanged
                    End If
                Case "grdCalendario"
                    Dim oRad As RadioButton = CType(e.Item.FindControl("oRad"), RadioButton)
                    If Not IsNothing(oRad) Then
                        oRad.Attributes.Add("OnClick", "SelectMeOnly(" & oRad.ClientID & ", " & "'grdCalendario'" & ")")
                        AddHandler oRad.CheckedChanged, AddressOf Me.grdCalendario_CheckChanged
                    End If
            End Select
        End If
    End Sub
 
    Private Sub restoreChkViewStateData()
        Dim oSolP As abSolpedPosicion
        If Not IsNothing(Me.oProc) Then
            For Each oSolP In Me.oProc.Posiciones
                ChkSolpedPos(oSolP.NumeroSolped.ToString() & "_" & oSolP.PosicionSolped.ToString()) = True
                ' TODO: Implementar deteccion de check en todos cuando los todos elementos del detalle esten en true
            Next
        End If
    End Sub
 
    Private Sub saveChkViewStateData()
        Dim oSolP As abSolpedPosicion
        Dim oEle As DictionaryEntry
        Dim aId() As String
        If Not IsNothing(Me.oProc) Then
            For Each oEle In ChkSolpedPos
                If oEle.Value = True Then
                    aId = oEle.Key.ToString.Split("_")
                    oSolP = New abSolpedPosicion(Me.oConn, aId(0), aId(1))
                    Me.oProc.Posiciones.Add(oSolP)
                End If
            Next
        End If
    End Sub
 
    Protected Sub SubmitButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cbtnGuardar.Click
        Dim sID As String = ""
        Dim sAct As String = ""
        Dim aStr() As String
        Dim oEve As abEvento
        sID = Me.hdnIds.Value
        sAct = Me.hdnAction.Value
        Select Case sender.ID
            Case "cbtnGuardar"
                If sAct = "n" Then
                    If sID.Length > 0 Then
                        aStr = sID.Split("_")
                        If aStr.Count = 2 Then
                            oEve = New abEvento(oConn.Clone(), aStr(0), aStr(1))
                        Else
                            Exit Sub
                        End If
                    Else
                        Exit Sub
                    End If
                Else
                    oEve = New abEvento(oConn.Clone(), Me.cmbSubProceso.SelectedValue.ToString())
                End If
                oEve.Titulo = Me.txtNomEvento.Text
                oEve.Descripcion = Me.txtSPDesc.Text
                oEve.FechaProgramadoInicial = Me.dpFecIni.SelectedDate
                oEve.FechaProgramadoFinal = Me.dpFecFin.SelectedDate
                If Me.cmbResp.SelectedValue <> Me.cmbRespEvento.SelectedValue Then
                    oEve.Responsable = Me.cmbRespEvento.SelectedValue
                End If
                If Me.oProc.Calendario.Add(oEve) Then
                    Me.txtSPDesc.Text = ""
                    Me.cmbTipEvento.SelectedIndex = 0
                    Me.dpFecIni.SelectedDate = DateTime.Today
                    Me.dpFecFin.SelectedDate = DateTime.Today
                End If
                'Me.grdCalendario.Rebind()
        End Select
    End Sub
 
    Private Sub CargarEvento()
 
        Dim sSprc As String = ""
        Dim sAct As String = ""
        Dim aStr() As String
        Dim oEve As abEvento
 
        sSprc = Me.hdnIds.Value
        sAct = Me.hdnAction.Value
 
        If sAct = "e" And sSprc.Length > 0 Then
            aStr = sSprc.Split("_")
            If aStr.Length > 1 Then
                oEve = New abEvento(oConn, aStr(0), aStr(1))
                Me.RadDock1.Title = "Editar " & oEve.Descripcion
                Me.txtSPDesc.Text = oEve.Descripcion
                Me.dpFecIni.SelectedDate = oEve.FechaProgramadoInicial
                Me.dpFecFin.SelectedDate = oEve.FechaProgramadoFinal
                Me.cmbRespEvento.SelectedValue = oEve.Responsable
            End If
        Else
            Me.RadDock1.Title = "Nuevo Evento"
            Me.txtSPDesc.Text = ""
            Me.dpFecIni.SelectedDate = DateTime.Today()
            Me.dpFecFin.SelectedDate = DateTime.Today()
            Me.cmbRespEvento.SelectedValue = Me.cmbResp.SelectedValue
        End If
    End Sub
End Class

ASPX:
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Templates/1Col.Master"
    CodeBehind="Proceso.aspx.vb" Inherits="adquisicioneNET.Proceso" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link type="text/css" rel="Stylesheet" href="../Templates/dialogo.css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cuerpo" runat="server">
    <telerik:RadScriptBlock runat="server" ID="RadScriptBlock2">
        <script type="text/javascript">
            function SelectMeOnly(objRadioButton, grdName) {
                var i, obj, pageElements;
                if (navigator.userAgent.indexOf("MSIE") != -1) {
                    pageElements = document.all; //IE browser
                }
                else if (navigator.userAgent.indexOf("Mozilla") != -1 || navigator.userAgent.indexOf("Opera") != -1) {
                    pageElements = document.documentElement.getElementsByTagName("input"); //FireFox/Opera browser
                }
                for (i = 0; i < pageElements.length; i++) {
                    obj = pageElements[i];
                    if (obj.type == "radio") {
                        if (objRadioButton.id.indexOf(grdName, 0) >= 0) {
                            if (objRadioButton.id == obj.id) {
                                obj.checked = true;
                            }
                            else {
                                obj.checked = false;
                            }
                        }
                    }
                }
            }
            function openForm() {
                var dock = $find("<%= RadDock1.ClientID %>");
                // Center the RadDock on the screen
                var viewPort = $telerik.getViewPortSize();
                var xPos = Math.round((viewPort.width - parseInt(dock.get_width())) / 2);
                var yPos = Math.round((viewPort.height ) / 2);//- parseInt(dock.get_height())
                $telerik.setLocation(dock.get_element(), { x: xPos, y: yPos });
                dock.set_closed(false);
                var descriptionTextBox = $get('<%= txtSPDesc.ClientID %>');
                descriptionTextBox.focus();
                Sys.Application.remove_load(openForm);
            }
 
            function hideForm() {
                var dock = $find("<%= RadDock1.ClientID %>");
                Sys.Application.remove_load(openForm);
                dock.set_closed(true);
                return true;
            }
 
            function dockMoved(sender, args) {
                //Return RadDock to his original HTML parent so it gets updated via ajax
                $get("<%= panDlgData.ClientID %>").appendChild(sender.get_element());
            }
        </script>
    </telerik:RadScriptBlock>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"></telerik:RadAjaxManager>
    <asp:UpdatePanel runat="server" ID="UpdPan1">
        <ContentTemplate>
            <table>
                <tr>
                    <td>
                        Nombre del proceso:
                    </td>
                    <td>
                        <asp:TextBox ID="txtNomEvento" runat="server" Width="232px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        Tipo de proceso:
                    </td>
                    <td>
                        <telerik:RadComboBox ID="cmbTipEvento" runat="server" Width="235px" AutoPostBack="True">
                        </telerik:RadComboBox>
                    </td>
                </tr>
                <tr>
                    <td class="style1">
                        Responsable:
                    </td>
                    <td class="style1">
                        <telerik:RadComboBox ID="cmbResp" runat="server" Width="235px" AutoPostBack="True">
                        </telerik:RadComboBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        Importe:
                    </td>
                    <td>
                        <telerik:RadNumericTextBox ID="txtImporte" runat="server" Culture="Spanish (Mexico)"
                            Type="Currency" Width="232px">
                        </telerik:RadNumericTextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        Prioridad:
                    </td>
                    <td>
                        <telerik:RadComboBox ID="cmbPrioridad" runat="server" Width="50px">
                            <Items>
                                <telerik:RadComboBoxItem runat="server" Text="A" Value="A" />
                                <telerik:RadComboBoxItem runat="server" Text="B" Value="B" />
                                <telerik:RadComboBoxItem runat="server" Selected="True" Text="C" Value="C" />
                            </Items>
                        </telerik:RadComboBox>
                        <telerik:RadComboBox ID="cmbRazon" runat="server" Width="187px">
                        </telerik:RadComboBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        Especialidad:
                    </td>
                    <td>
                        <telerik:RadComboBox ID="cmbEspecialidad" runat="server" Width="235px">
                        </telerik:RadComboBox>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:HiddenField ID="hdnAction" runat="server" />
                        <asp:HiddenField ID="hdnIds" runat="server" />
                        <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="Default, Textbox, Textarea, Fieldset, Label, Select"
                            Skin="WebBlue" />
                        <div class="r2k_err">
                            <input id="Hidden1" type="hidden" />
                            <div class="r2k_iicon">
                                <asp:Image ID="Image2" runat="server" ImageUrl="~/imgs/icons/dialog-error.png"></asp:Image></div>
                            <div class="r2k_imsg">
                                Prueba de Validaciones
                            </div>
                        </div>
                        <div class="r2k_warn">
                            <div class="r2k_iicon">
                                <asp:Image ID="Image1" runat="server" ImageUrl="~/imgs/icons/dialog-warning.png">
                                </asp:Image></div>
                            <div class="r2k_imsg">
                                La pestaña de eventos se mantendra deshabilitada hasta que Ud. agregue cuando menos
                                una solped en el proceso
                            </div>
                        </div>
                        <telerik:RadTabStrip ID="oTabMan" runat="server" MultiPageID="RadMultiPage2" SelectedIndex="0">
                            <Tabs>
                                <telerik:RadTab runat="server" Text="Solpeds y Posiciones" PageViewID="pagSolPos"
                                    Selected="True">
                                </telerik:RadTab>
                                <telerik:RadTab runat="server" Text="Eventos" PageViewID="pagEventos" Enabled="False">
                                </telerik:RadTab>
                            </Tabs>
                        </telerik:RadTabStrip>
                        <telerik:RadMultiPage ID="RadMultiPage2" runat="server" BorderColor="Black" BorderStyle="Solid"
                            BorderWidth="1px" SelectedIndex="0">
                            <telerik:RadPageView ID="pagSolPos" runat="server">
                                <contenttemplate>
                                        <asp:PlaceHolder ID="phGrdSolPos" runat="server"></asp:PlaceHolder>
                                        </contenttemplate>
                            </telerik:RadPageView>
                            <telerik:RadPageView ID="pagEventos" runat="server">
                                <contenttemplate>
                                        <asp:PlaceHolder ID="phGrdCal" runat="server"></asp:PlaceHolder>
                                    </contenttemplate>
                                
                            </telerik:RadPageView>
                             
                        </telerik:RadMultiPage>
                    </td>
                </tr>
            </table>
        </ContentTemplate>
    </asp:UpdatePanel>
    <telerik:RadAjaxPanel ID="panDlgData" runat="server" width="400px">
        <telerik:RadDock ID="RadDock1" runat="server" Width="400px" Closed="True" style="z-index:2410;">
            <ContentTemplate>
                    <div class="editForm">
        <table>
            <tr>
                <td>
                    Responsable:
                </td>
                <td>
                    <telerik:RadComboBox ID="cmbRespEvento" runat="server" AutoPostBack="True" Width="235px">
                    </telerik:RadComboBox>
                </td>
            </tr>
            <tr>
                <td>
                    Tipo Evento:
                </td>
                <td>
                    <telerik:RadComboBox ID="cmbSubProceso" runat="server" AutoPostBack="True">
                    </telerik:RadComboBox>
                </td>
            </tr>
            <tr>
                <td>
                    Incio:
                </td>
                <td>
                    <telerik:RadDateTimePicker ID="dpFecIni" runat="server" Culture="Spanish (Mexico)">
                        <Calendar UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False" ViewSelectorText="x">
                        </Calendar>
                        <TimeView CellSpacing="-1" Culture="Spanish (Mexico)" HeaderText="Seleccione la hora">
                        </TimeView>
                        <TimePopupButton HoverImageUrl="" ImageUrl="" />
                        <DatePopupButton HoverImageUrl="" ImageUrl="" />
                        <DateInput DateFormat="dd/MM/yyyy" DisplayDateFormat="dd/MM/yyyy">
                        </DateInput>
                    </telerik:RadDateTimePicker>
                </td>
            </tr>
            <tr>
                <td>
                    Fin:
                </td>
                <td>
                    <telerik:RadDateTimePicker ID="dpFecFin" runat="server" Culture="Spanish (Mexico)">
                        <Calendar UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False" ViewSelectorText="x">
                        </Calendar>
                        <TimeView CellSpacing="-1" Culture="Spanish (Mexico)" HeaderText="Seleccione la hora">
                        </TimeView>
                        <TimePopupButton HoverImageUrl="" ImageUrl="" />
                        <DatePopupButton HoverImageUrl="" ImageUrl="" />
                        <DateInput DateFormat="dd/MM/yyyy" DisplayDateFormat="dd/MM/yyyy">
                        </DateInput>
                    </telerik:RadDateTimePicker>
                </td>
            </tr>
            <tr>
                <td>
                    Descripcion:
                </td>
                <td>
                    <telerik:RadTextBox ID="txtSPDesc" runat="server" Width="300px">
                    </telerik:RadTextBox>
                </td>
            </tr>
        </table>
    </div>
    <div class="footer">
        <asp:Button runat="server" ID="cbtnGuardar" Text="Guardar" OnClick="SubmitButton_Click"
            OnClientClick="return hideForm()" />
        <button onclick="javascript:hideForm();" type="button">
            Cancelar</button>
    </div>
            </ContentTemplate>
        </telerik:RadDock>
    </telerik:RadAjaxPanel>
</asp:Content>

a bit complex ;)

3 Answers, 1 is accepted

Sort by
0
Rafaga2k
Top achievements
Rank 1
answered on 13 Dec 2010, 07:15 PM
Bump for update in my post adding code and some screenshots
first photo is the action for the first time that the button is pressed the other one is for the subsecuent times...
0
Accepted
Cori
Top achievements
Rank 2
answered on 14 Dec 2010, 01:57 PM
I noticed that your using three different ajax controls on your page: RadAjaxManager, UpdatePanel and RadAjaxPanel. I don't think your supposed to use all of them on the same page. Have you tried just ajaxifying your controls with just the RadAjaxManager, instead of wrapping certain controls in UpdatePanel/RadAjaxPanel's and see if that fixes your issue.
0
Rafaga2k
Top achievements
Rank 1
answered on 14 Dec 2010, 09:31 PM
ok i followed all your suggestions and the problem of duplicated AjaxRequest has solved, but for any reason the radDock1 works only the first 2 times i invoke it; the subsequent times doesn't works .... any Ideas ????

Edit: It works ... all 100% thanks a lot :D ... i don't when i have figured that by myself ... i didn't know that 3 objects are causing interference between them.
Tags
Ajax
Asked by
Rafaga2k
Top achievements
Rank 1
Answers by
Rafaga2k
Top achievements
Rank 1
Cori
Top achievements
Rank 2
Share this question
or