Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
203 views
Good Day Admin

i have a radeditor that is defined like this

<telerik:RadEditor ID="txtbody" runat="server" Skin="Sunset">
        <Tools>
            <telerik:EditorToolGroup Tag="MainToolbar">
                <telerik:EditorTool Name="FindAndReplace" />
                <telerik:EditorSeparator />
                <telerik:EditorTool Name="Undo" />
                <telerik:EditorTool Name="Redo" />
                <telerik:EditorSeparator />
                <telerik:EditorTool Name="Cut" />
                <telerik:EditorTool Name="Copy" />
                <telerik:EditorTool Name="Paste" ShortCut="CTRL+!" />
            </telerik:EditorToolGroup>
            <telerik:EditorToolGroup Tag="Formatting">
                <telerik:EditorTool Name="Bold" />
                <telerik:EditorTool Name="Italic" />
                <telerik:EditorTool Name="Underline" />
                <telerik:EditorSeparator />
                <telerik:EditorTool Name="ForeColor" />
                <telerik:EditorTool Name="BackColor" />
                <telerik:EditorSeparator />
                <telerik:EditorTool Name="FontName" />
                <telerik:EditorTool Name="RealFontSize" />
            </telerik:EditorToolGroup>
        </Tools>
        <Content>
</Content>
    </telerik:RadEditor>

when i run my application the Rad-editor, show the toolbar fine, but you cant write anything on in. Its like disabled, the writing does nothing.

Thanks
Vuyiswa
Top achievements
Rank 2
 answered on 24 Aug 2010
1 answer
294 views
Ok... on a standard GridView and I can do this:

protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
    string fileName = e.Values["FullName"].ToString();
    if (File.Exists(Server.MapPath("~/Uploads/" + fileName)))
    {
        File.Delete(Server.MapPath("~/Uploads/" + fileName));
    }
}

Can someone please tell me the equivalent uisng the RadGrid... I'm pulling my hair out. 

Thanks!!!
Sebastian
Telerik team
 answered on 24 Aug 2010
1 answer
137 views
Hi:

I'm developing some pages to use as templates, and one of them has a radlistview in the left side. There seems to be no problem when firing the Initinsert ItemCommand when that radlistview has items, but when firing it with no items, I get a JScript null reference exception. It's driving me nuts, since I cannot find what is causing the exception. Maybe I should manage some event, I don't know... I hope someone can lend me a hand on this.

Here is the code:

Parent page aspx:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Raiz.aspx.vb" Inherits="PruebasTelerik.Raiz" %>
 
<%@ Register Assembly="Telerik.Web.UI, Version=2010.2.713.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
    Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <asp:UpdatePanel ID="upPrincipal" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:Panel ID="pPrincipal" runat="server" CssClass="SeccionPrincipal" ScrollBars="None"
                Height="83%">
                <asp:UpdatePanel ID="upSeccionLateral" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <asp:Panel ID="SeccionLateral" runat="server" CssClass="SeccionIzquierda">
                            <%-- Aquí va el RadListView o RadTreeView en el cual seleccionar el elemento --%>
                            Lateral
                        </asp:Panel>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <asp:UpdatePanel ID="upSeccionDerecha" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <asp:Panel ID="SeccionDerecha" CssClass="SeccionDerecha" runat="server" Height="100%"
                            ScrollBars="Auto" Visible="false">
                            <asp:Label ID="lblInfo" Text="" CssClass="ContenidoInteriorTituloSinBarra" runat="server" />
                            <telerik:RadTabStrip ID="Pestanyas" runat="server" SelectedIndex="0" ValidationGroup="GrupoValidacionDatosGenerales"
                                MultiPageID="ContenidoPestanyas" Width="90%">
                                <Tabs>
                                    <telerik:RadTab PageViewID="VistaDatosGenerales" Selected="true" Text="Datos Generales"
                                        Value="0" CssClass="Pestanya" SelectedCssClass="Pestanya" HoveredCssClass="Pestanya" />
                                </Tabs>
                            </telerik:RadTabStrip>
                            <telerik:RadMultiPage ID="ContenidoPestanyas" runat="server" CssClass="MultiPage"
                                SelectedIndex="0">
                                <telerik:RadPageView ID="VistaDatosGenerales" runat="server" Selected="True">
                                    VistaDatosGenerales
                                </telerik:RadPageView>
                            </telerik:RadMultiPage>
                            <div id="SeccionEdicion" runat="server" class="BotonesEdicion">
                                <table border="0" cellpadding="0" cellspacing="0" runat="server" id="botonesInsertar"
                                    visible="false">
                                    <tr>
                                        <td valign="top">
                                            <img alt="Guardando..." src="../images_diseno/bt_guardar_OFF.png" border="0" style="display: none;"
                                                id="cmdInsertarBlanco" />
                                            <asp:ImageButton AlternateText="Insertar" ImageUrl="../images_diseno/bt_guardar.png"
                                                OnClick="cmdInsertar_Click" CommandName="Insertar" ID="cmdInsertar" runat="server"
                                                OnClientClick="return realizarValidacion();" />
                                        </td>
                                        <td valign="top">
                                            <img alt="" src="../images_diseno/bt_separador.png" />
                                            <asp:ImageButton AlternateText="Cancelar" ImageUrl="../images_diseno/bt_cancelar.png"
                                                CommandName="CancelarInsertando" ID="cmdCancelar" runat="server" OnClick="cmdCancelar_Click"
                                                CausesValidation="false" />
                                        </td>
                                    </tr>
                                </table>
                                <table border="0" cellpadding="0" cellspacing="0" runat="server" id="botonesSeleccionar"
                                    visible="true">
                                    <tr>
                                        <td valign="top">
                                            <asp:ImageButton AlternateText="Editar" ImageUrl="../images_diseno/bt_editar.png"
                                                CommandName="Edit" CausesValidation="false" ID="cmdEditar" runat="server" OnClick="cmdEditar_Click" />
                                        </td>
                                        <td valign="top">
                                            <img alt="" src="../images_diseno/bt_separador.png" />
                                            <asp:ImageButton AlternateText="Borrar" ImageUrl="../images_diseno/bt_eliminar.png"
                                                OnClick="cmdBorrar_Click" CommandName="Baja" CausesValidation="false" ID="cmdBorrar"
                                                runat="server" OnClientClick="return ConfirmarBorrado(this);" />
                                        </td>
                                    </tr>
                                </table>
                                <table border="0" cellpadding="0" cellspacing="0" runat="server" id="botonesEditar"
                                    visible="false">
                                    <tr>
                                        <td valign="top">
                                            <asp:ImageButton AlternateText="Actualizar" ImageUrl="../images_diseno/bt_guardar.png"
                                                CommandName="Editar" ID="cmdActualizar" runat="server" OnClick="cmdActualizar_Click" />
                                        </td>
                                        <td valign="top">
                                            <img alt="" src="../images_diseno/bt_separador.png" />
                                            <asp:ImageButton AlternateText="Cancelar" ImageUrl="../images_diseno/bt_cancelar.png"
                                                OnClick="cmdCancelar2_Click" CommandName="Cancel" ID="cmdCancelar2" runat="server"
                                                CausesValidation="false" />
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </asp:Panel>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdateProgress ID="upIndicadorUpdate" AssociatedUpdatePanelID="upPrincipal"
        runat="server">
        <ProgressTemplate>
            <div class="IndicadorProgreso">
                <img src="../images_diseno/ajax-loader.gif" alt="Cargando..." id="loadingimage" class="TotalmenteCentrado" />
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
    <asp:HiddenField ID="hdDatosGeneralesEditando" runat="server" />
    <asp:HiddenField ID="hdGuardarCambios" runat="server" />
    <asp:HiddenField ID="hdUltimaFichaVista" runat="server" />
    <asp:HiddenField ID="hdMantenimientoActualizado" runat="server" />
    <asp:HiddenField ID="hdIdRegistro" runat="server" />
    <telerik:RadCodeBlock ID="rcbCodigoCliente" runat="server">
 
        <script type="text/javascript">
 
            function comprobarNoElementosSinGuardar(indexFichaSeleccionada) {
                var elementosSinGuardar = false
                var vista = document.getElementById('<%=hdUltimaFichaVista.ClientID%>');
                if (vista.value == '') {
                    vista.value = '0';
                }
                var EditandoDatosGenerales = document.getElementById('<%=hdDatosGeneralesEditando.ClientID%>');
 
                // En caso de que sea la ficha 0 (Datos Generales) comprobamos que el resto de fichas no esten en edicion
                if (vista.value == 0 && indexFichaSeleccionada != 0) {
                    if (EditandoDatosGenerales.value == 'true') {
                        elementosSinGuardar = true;
                    }
                }
                return elementosSinGuardar;
            }
 
            var isTabClicked = false;
            var tabPulsado;
 
            function onTabSelecting(sender, args) {
                var multiPagina = document.getElementById('<%=ContenidoPestanyas.ClientID%>');
                var tabOriginal = sender.get_selectedTab();
                tabPulsado = args.get_tab();
                var valorOriginal = null;
                if (tabOriginal) {
                    valorOriginal = tabOriginal.get_value();
                }
                else {
                    valorOriginal = 0;
                }
                var vista = document.getElementById('<%=hdUltimaFichaVista.ClientID%>');
                vista.value = valorOriginal;
                if ((isTabClicked == false) && (comprobarNoElementosSinGuardar(tabPulsado.get_value()))) {
                    var oWnd = window.radopen('../controles/alertas.aspx?msg=' + '1', 'Alerta de Guardado');
                    // Opens the window
                    oWnd.add_close(cierreConfirmacionTabSelecting);
                    // set a function to be called when RadWindow is closed
                    args.set_cancel(true);
                }
                else {
                    isTabClicked = false
                    return true;
                }
            }
 
            function cierreConfirmacionTabSelecting(oWnd, args) {
                isTabClicked = true;
                oWnd.setUrl("about:blank");
                // Sets url to blank
                oWnd.remove_close(CierreConfirmacionSeleccion);
                // remove the close handler - it will be set again on the next opening
                var arg = args.get_argument();
                if (arg) {
                    var EditandoDatosGenerales = document.getElementById('<%=hdDatosGeneralesEditando.ClientID%>');
                    var bt = arg.boton
                    var hdGuardarCambios = document.getElementById('<%=hdGuardarCambios.ClientID%>');
 
                    switch (bt) {
                        case 1:
                            // botonpulsado = 'Si';
                            var hdGuardarCambios = document.getElementById('<%=hdGuardarCambios.ClientID%>');
                            if (hdGuardarCambios) {
                                hdGuardarCambios.value = 'true';
                                if (tabPulsado) {
                                    tabPulsado.click();
                                }
                            }
                            break;
                        case 2:
                            // botonpulsado = 'No';
                            EditandoDatosGenerales.value = 'false';
                            if (hdGuardarCambios) {
                                hdGuardarCambios.value = 'false';
                                var botonCancelar = document.getElementById('<%=cmdCancelar2.ClientID %>');
                                if (botonCancelar) {
                                    botonCancelar.click();
                                }
                                if (tabPulsado) {
                                    tabPulsado.click();
                                }
                            }
                            break;
                        case 3:
                            // botonpulsado = 'Cancelar';
                            isTabClicked = false;
                            break;
                    }
                }
            }
 
            function realizarValidacion(nombreGrupoValidacion) {
                if ((nombreGrupoValidacion == null) || (nombreGrupoValidacion == '')) {
                    Page_ClientValidate();
                }
                else {
                    Page_ClientValidate(nombreGrupoValidacion);
                }
                if (Page_IsValid) {
                    return true;
                }
                else {
                    return false;
                }
            }
             
        </script>
 
    </telerik:RadCodeBlock>
 
    </form>
</body>
</html>

Parent page codebehind:

Imports Telerik.Web.UI
Imports System.Reflection
 
Partial Public Class Raiz
    Inherits System.Web.UI.Page
 
 
    Protected IdSeguridad As Integer = 3
    Protected Delegate Function FuncionRecuperacionDatosComboBox() As List(Of ListItem)
    Protected Delegate Function FuncionRecuperacionDatosComboBoxLigado(ByVal IdRegistro As Integer) As List(Of ListItem)
 
    Protected Overridable Sub Page_Load(ByVal origen As Object, ByVal argumentos As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            ComprobarPermisosEdicion(IdSeguridad)
            CargarDesplegablesEstaticos()
            hdDatosGeneralesEditando.Value = "N"
        End If
    End Sub
 
    Protected Overridable Sub CargarDatosDcha(ByVal IdRegistro As Integer)
 
    End Sub
 
     Protected Overridable Sub cmdActualizar_Click(ByVal origen As Object, ByVal argumentos As ImageClickEventArgs)
        Editar(False)
    End Sub
 
    Protected Overridable Sub cmdBorrar_Click(ByVal origen As Object, ByVal argumentos As ImageClickEventArgs)
        BorrarDatosDcha()
        Editar(False)
        VerSeccionDcha(False)
    End Sub
 
     Protected Overridable Sub cmdCancelar_Click(ByVal origen As Object, ByVal argumentos As ImageClickEventArgs)
        BorrarDatosDcha()
        VerSeccionDcha(False)
        Editar(False)
    End Sub
 
    Protected Sub cmdCancelar2_Click(ByVal origen As Object, ByVal argumentos As ImageClickEventArgs)
        BorrarDatosDcha()
        If hdIdRegistro IsNot Nothing AndAlso Not hdIdRegistro.Value.Equals(String.Empty) AndAlso IsNumeric(hdIdRegistro.Value) Then
            CargarDatosDcha(hdIdRegistro.Value)
        End If
        Editar(False)
    End Sub
 
    Protected Sub cmdEditar_Click(ByVal origen As Object, ByVal argumentos As ImageClickEventArgs)
        Editar(True)
    End Sub
 
    Protected Overridable Sub cmdInsertar_Click(ByVal origen As Object, ByVal argumentos As ImageClickEventArgs)
 
    End Sub
 
    Protected Overridable Sub cmdNuevo_Click(ByVal origen As Object, ByVal argumentos As ImageClickEventArgs)
        TabPulsado(Pestanyas, New RadTabStripEventArgs(Pestanyas.Tabs(0)))
        BorrarDatosDcha()
        Pestanyas.Tabs(0).Selected = True
        Pestanyas.SelectedIndex = 0
        ContenidoPestanyas.SelectedIndex = 0
        VerSeccionDcha(True)
        Editar(True)
        botonesEditar.Visible = False
        botonesInsertar.Visible = True
        lblInfo.Text = "Complete los siguientes datos"
    End Sub
 
    Protected Overridable Sub Editar(ByVal enEdicion As Boolean)
        CambiarHiddenEditando(enEdicion)
        HabilitarValidadores(enEdicion)
        botonesEditar.Visible = enEdicion
        botonesSeleccionar.Visible = Not enEdicion
        botonesInsertar.Visible = False
    End Sub
 
    Protected Sub EstablecerEdicionDesplegable(ByVal desplegable As RadComboBox, ByVal enEdicion As Boolean, Optional ByVal botonMantenimiento As ImageButton = Nothing)
        desplegable.Enabled = enEdicion
        If desplegable.Items.Count > 0 Then
            desplegable.Enabled = enEdicion
            If botonMantenimiento IsNot Nothing Then
                botonMantenimiento.Enabled = enEdicion
                If enEdicion Then
                    botonMantenimiento.ImageUrl = "../images_diseno/bt_mas.png"
                Else
                    botonMantenimiento.ImageUrl = "../images_diseno/bt_mas_off.png"
                End If
            End If
        Else
            desplegable.Enabled = False
            If botonMantenimiento IsNot Nothing Then
                botonMantenimiento.Enabled = False
                botonMantenimiento.ImageUrl = "../images_diseno/bt_mas_off.png"
            End If
        End If
    End Sub
 
    Protected Sub VerSeccionDcha(ByVal visible As Boolean)
        SeccionDerecha.Visible = visible
    End Sub
 
    Protected Sub CambiarHiddenEditando(ByVal enEdicion As Boolean)
        hdDatosGeneralesEditando.Value = enEdicion.ToString.ToLower
    End Sub
 
    Protected Sub CancelarCambios()
        If botonesInsertar.Visible = True Then
            cmdCancelar_Click(Nothing, Nothing)
        ElseIf botonesEditar.Visible = True Then
            cmdCancelar2_Click(Nothing, Nothing)
        End If
    End Sub
 
    Protected Sub GuardarCambios()
        If hdDatosGeneralesEditando.Value.Equals(Boolean.TrueString.ToLower) Then
            If botonesEditar.Visible Then
                cmdActualizar_Click(Nothing, Nothing)
            ElseIf botonesInsertar.Visible Then
                cmdInsertar_Click(Nothing, Nothing)
            End If
            Editar(False)
            CambiarHiddenEditando(False)
        End If
    End Sub
 
    Protected Overridable Sub TabPulsado(ByVal origen As Object, ByVal argumentos As RadTabStripEventArgs)
        Dim tabAnterior As Integer = -1
        If hdUltimaFichaVista IsNot Nothing AndAlso Not hdUltimaFichaVista.Value.Equals(String.Empty) AndAlso IsNumeric(hdUltimaFichaVista.Value) Then
            tabAnterior = Integer.Parse(hdUltimaFichaVista.Value)
        End If
        Dim tabSeleccionado As RadTab = argumentos.Tab
        If hdGuardarCambios.Value.Equals(Boolean.TrueString.ToLower) Then
            Select Case tabAnterior
                Case 0
                    GuardarCambios()
            End Select
        Else
            Select Case tabAnterior
                Case 0
                    CancelarCambios()
            End Select
        End If
        hdUltimaFichaVista.Value = tabSeleccionado.Index
        hdGuardarCambios.Value = Boolean.FalseString.ToLower
    End Sub
 
    Protected Overridable Sub Orden(ByVal origen As Object, ByVal argumentos As CommandEventArgs)
        Select Case argumentos.CommandName
            Case "Select"
                hdIdRegistro.Value = argumentos.CommandArgument
                If (hdGuardarCambios.Value = "true") Then
                    GuardarCambios()
                    hdGuardarCambios.Value = "false"
                Else
                    CancelarCambios()
                End If
                Dim args As New RadTabStripEventArgs(Pestanyas.SelectedTab)
                TabPulsado(Me, args)
                VerSeccionDcha(True)
                Editar(False)
                BorrarDatosDcha()
                CargarDatosDcha(argumentos.CommandArgument)
                actualizarPaneles()
        End Select
    End Sub
 
    Protected Overridable Sub BorrarDatosDcha()
        lblInfo.Text = ""
    End Sub
 
    Protected Sub ComprobarPermisosEdicion(ByVal Id As Integer)
        Dim TienePermisoEdicion As Boolean = True 'ComprobarPermisos(Id)
        If TienePermisoEdicion Then
            cmdEditar.Enabled = True
            cmdEditar.ImageUrl = "../images_diseno/bt_editar.png"
            cmdEditar.AlternateText = "Editar"
            cmdEditar.Attributes.Add("alt", "Editar")
 
            cmdBorrar.Enabled = True
            cmdBorrar.ImageUrl = "../images_diseno/bt_eliminar.png"
            cmdBorrar.AlternateText = "Eliminar"
            cmdBorrar.Attributes.Add("alt", "Eliminar")
        Else
            cmdEditar.Enabled = False
            cmdEditar.ImageUrl = "../images_diseno/bt_editar_OFF.png"
            cmdEditar.AlternateText = "Editar (No tiene permisos para esta acción)"
            cmdEditar.Attributes.Add("alt", "Editar (No tiene permisos para esta acción)")
 
            cmdBorrar.Enabled = False
            cmdBorrar.ImageUrl = "../images_diseno/bt_eliminar_OFF.png"
            cmdBorrar.AlternateText = "Eliminar (No tiene permisos para esta acción)"
            cmdBorrar.Attributes.Add("alt", "Eliminar (No tiene permisos para esta acción)")
        End If
    End Sub
 
    Protected Overridable Sub CargarDesplegablesEstaticos()
 
    End Sub
 
    Protected Overridable Sub HabilitarValidadores(ByVal enEdicion As Boolean)
 
    End Sub
 
    Protected Overridable Function LeerRegistro() As Object
        Return Nothing
    End Function
 
    Protected Overridable Sub hdMantenimiento_ValueChanged(ByVal origen As Object, ByVal argumentos As EventArgs)
 
    End Sub
 
 
    Protected Sub CargarComboIndependiente(ByVal desplegable As RadComboBox, ByVal funcionCargaDatos As FuncionRecuperacionDatosComboBox, Optional ByVal soloDatosRecuperados As Boolean = False)
        Dim datos As List(Of ListItem) = funcionCargaDatos.Invoke
        CargarCombo(desplegable, datos, soloDatosRecuperados)
    End Sub
 
    Protected Sub CargarComboDependiente(ByVal desplegable As RadComboBox, ByVal funcionCargaDatos As FuncionRecuperacionDatosComboBoxLigado, ByVal IdSeleccionado As Integer, Optional ByVal soloDatosRecuperados As Boolean = False)
        If IdSeleccionado = 0 Then
            desplegable.Items.Clear()
            desplegable.Enabled = False
        Else
            Dim datos As List(Of ListItem) = funcionCargaDatos.Invoke(IdSeleccionado)
            CargarCombo(desplegable, datos, soloDatosRecuperados)
        End If
    End Sub
 
    Private Sub CargarCombo(ByVal desplegable As RadComboBox, ByVal datos As List(Of ListItem), Optional ByVal soloDatosRecuperados As Boolean = False)
        If datos IsNot Nothing Then
            For Each Item As ListItem In datos
                desplegable.Items.Add(New RadComboBoxItem(Item.Text, Item.Value))
            Next
        End If
        If Not soloDatosRecuperados Then
            Dim ElementoInicio As New RadComboBoxItem("Seleccione un registro...", 0)
            ElementoInicio.Selected = True
            desplegable.Items.Insert(0, ElementoInicio)
            desplegable.SelectedIndex = 0
            desplegable.SelectedValue = 0
        End If
    End Sub
 
    Protected Sub actualizarPaneles()
        upSeccionDerecha.Update()
        upSeccionLateral.Update()
        upPrincipal.Update()
    End Sub
 
End Class

Child page aspx:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Listado.aspx.vb" Inherits="PruebasTelerik.Listado" %>
 
<%@ Register Assembly="Telerik.Web.UI, Version=2010.2.713.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
    Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <asp:UpdatePanel ID="upPrincipal" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:Panel ID="pPrincipal" runat="server" CssClass="SeccionPrincipal" ScrollBars="None"
                Height="83%">
                <asp:UpdatePanel ID="upSeccionLateral" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <asp:Panel ID="SeccionLateral" runat="server" CssClass="SeccionIzquierda">
                            <%-- Aquí va el RadListView o RadTreeView en el cual seleccionar el elemento --%>
                            <div class="ListadoLateral" style="width: 100%;">
                                <telerik:RadListView ID="rlvListado" runat="server" DataKeyNames="Value" OnItemCommand="Orden" OnItemInserting="pruebaInsercion" OnItemInserted="pruebaInsercion" OnItemCreated="pruebaInsercion"
                                    OnSelectedIndexChanged="CambioSelect" OnNeedDataSource="CargarListado" EnableViewState="False">
                                    <LayoutTemplate>
                                        <div class="CabeceraListado">
                                            <div class="ParteIzquierdaCL">
                                            </div>
                                            <div class="ParteCentralCL">
                                                <asp:Label ID="lblCabecera" runat="server" Text="Tipo de registro" CssClass="Cabecera" />
                                            </div>
                                            <div class="ParteDerechaCL">
                                            </div>
                                        </div>
                                        <div class="Buscador">
                                            <telerik:RadTextBox ID="txtBuscar" runat="server" class="BuscadorTxt" />
                                            <asp:ImageButton Visible="true" alt="Buscar" ImageUrl="../images_diseno/bt_buscar.png"
                                                ID="cmdBuscar" runat="server" class="BuscadorBtn" OnClick="cmdBuscar_Click" />
                                        </div>
                                        <div class="LineaSeparacionDivs">
                                            <div class="LineaSeparacionDivsDcha">
                                            </div>
                                            <div class="LineaSeparacionDivsBorde">
                                            </div>
                                        </div>
                                        <div class="Listado">
                                            <div id="ListadoInterior" class="ListadoInterior">
                                                <div class="ContenidoConScrollPrincipal">
                                                    <div id="groupPlaceholder" runat="server">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="LineaSeparacionDivs">
                                            <div class="LineaSeparacionDivsDcha">
                                            </div>
                                            <div class="LineaSeparacionDivsBorde">
                                            </div>
                                        </div>
                                        <div class="SeccionEdicion">
                                            <div class="ParteIzquierdaSE">
                                            </div>
                                            <div class="ParteCentralSE">
                                                <asp:ImageButton ImageUrl="../images_diseno/bt_nuevoprod.png" alt="New Item" ID="cmdNuevo"
                                                    runat="server" CssClass="Cabecera" CommandName="InitInsert" OnClientClick="InsertNewItem()" />
                                            </div>
                                            <div class="ParteDerechaSE">
                                            </div>
                                        </div>
                                    </LayoutTemplate>
                                    <GroupSeparatorTemplate>
                                        <div class="LineaSeparacionDivs">
                                        </div>
                                    </GroupSeparatorTemplate>
                                    <GroupTemplate>
                                        <div id="itemPlaceholder" runat="server">
                                        </div>
                                    </GroupTemplate>
                                    <ItemSeparatorTemplate>
                                    </ItemSeparatorTemplate>
                                    <ItemTemplate>
                                        <fieldset class="OpcionFondoBlanco" id="ItemFieldSet" style="border-width: 0px">
                                            <asp:LinkButton CssClass="TextoOpcionesMenuNavegacion" ID="cmdAmpliar" OnClientClick="return ConfirmarSeleccion(this)"
                                                CommandName="Select" runat="server" CausesValidation="false" CommandArgument='<%#Eval("Value")%>'
                                                Text='<%# Eval("Text")%>'></asp:LinkButton>
                                        </fieldset>
                                    </ItemTemplate>
                                    <AlternatingItemTemplate>
                                        <fieldset class="OpcionFondoGris" id="AlternatingFieldSet" style="border-width: 0px">
                                            <asp:LinkButton CssClass="TextoOpcionesMenuNavegacion" ID="cmdAmpliar" OnClientClick="return ConfirmarSeleccion(this)"
                                                CommandName="Select" runat="server" CausesValidation="false" CommandArgument='<%#Eval("Value")%>'
                                                Text='<%# Eval("Text")%>'></asp:LinkButton>
                                        </fieldset>
                                    </AlternatingItemTemplate>
                                    <EmptyItemTemplate>
                                        <span class="LabelContenido"></span>
                                    </EmptyItemTemplate>
                                    <EmptyDataTemplate>
                                        <div class="CabeceraListado">
                                            <div class="ParteIzquierdaCL">
                                            </div>
                                            <div class="ParteCentralCL">
                                                <asp:Label ID="lblCabecera" runat="server" Text="Tipo de registro" CssClass="Cabecera" />
                                            </div>
                                            <div class="ParteDerechaCL">
                                            </div>
                                        </div>
                                        <div class="Buscador">
                                            <asp:TextBox Visible="true" ID="txtBuscar" runat="server" class="BuscadorTxt" ></asp:TextBox>
                                            <asp:ImageButton Visible="true" alt="Buscar" ImageUrl="../images_diseno/bt_buscar.png"
                                                ID="cmdBuscar" runat="server" class="BuscadorBtn" OnClick="cmdBuscar_Click" />
                                        </div>
                                        <div class="LineaSeparacionDivs">
                                            <div class="LineaSeparacionDivsDcha">
                                            </div>
                                            <div class="LineaSeparacionDivsBorde">
                                            </div>
                                        </div>
                                        <div class="Listado">
                                            <div id="ListadoInterior" class="ListadoInterior">
                                                <div class="ContenidoConScrollPrincipal" style="min-height: 40px;">
                                                    <span style="height: 19px; margin: 5px;" class="LabelContenido">
                                                        <asp:Label runat="server" ID="EmptyDataTemplate" Text="    No existen registros"></asp:Label>
                                                    </span>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="LineaSeparacionDivs">
                                            <div class="LineaSeparacionDivsDcha">
                                            </div>
                                            <div class="LineaSeparacionDivsBorde">
                                            </div>
                                        </div>
                                        <div class="SeccionEdicion">
                                            <div class="ParteIzquierdaSE">
                                            </div>
                                            <div class="ParteCentralSE">
                                                <asp:ImageButton ImageUrl="../images_diseno/bt_nuevoprod.png" alt="New Item" ID="cmdNuevo"
                                                    runat="server" CssClass="Cabecera" CommandName="InitInsert" OnClientClick="InsertNewItem()" />
                                            </div>
                                            <div class="ParteDerechaSE">
                                            </div>
                                        </div>
                                    </EmptyDataTemplate>
                                    <SelectedItemTemplate>
                                        <fieldset class="OpcionFondoVerde" id="ItemFieldSet" style="border-width: 0px">
                                            <asp:LinkButton ID="cmdReducir" CausesValidation="false" CssClass="TextoOpcionesMenuNavegacion"
                                                runat="server" OnClick="Cierra" Text='<%# Eval("Text")%>' CommandName="Deselect"
                                                OnClientClick="deseleccionar(this);" CommandArgument="0"></asp:LinkButton>
                                        </fieldset>
                                    </SelectedItemTemplate>
                                    <EditItemTemplate>
                                        <div class="OpcionFondoVerde">
                                            <%#Eval("Text")%>
                                        </div>
                                    </EditItemTemplate>
                                    <InsertItemTemplate>
                                        <div class="OpcionFondoVerde">
                                              
                                        </div>
                                    </InsertItemTemplate>
                                </telerik:RadListView>
                            </div>
                        </asp:Panel>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <asp:UpdatePanel ID="upSeccionDerecha" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <asp:Panel ID="SeccionDerecha" CssClass="SeccionDerecha" runat="server" Height="100%"
                            ScrollBars="Auto" Visible="false">
                            <asp:Label ID="lblInfo" Text="" CssClass="ContenidoInteriorTituloSinBarra" runat="server" />
                            <telerik:RadTabStrip ID="Pestanyas" runat="server" SelectedIndex="0" ValidationGroup="GrupoValidacionDatosGenerales"
                                MultiPageID="ContenidoPestanyas" Width="90%">
                                <Tabs>
                                    <telerik:RadTab PageViewID="VistaDatosGenerales" Selected="true" Text="Datos Generales"
                                        Value="0" CssClass="Pestanya" SelectedCssClass="Pestanya" HoveredCssClass="Pestanya" />
                                </Tabs>
                            </telerik:RadTabStrip>
                            <telerik:RadMultiPage ID="ContenidoPestanyas" runat="server" CssClass="MultiPage"
                                SelectedIndex="0">
                                <telerik:RadPageView ID="VistaDatosGenerales" runat="server" Selected="True">
                                    VistaDatosGenerales
                                </telerik:RadPageView>
                            </telerik:RadMultiPage>
                            <div id="SeccionEdicion" runat="server" class="BotonesEdicion">
                                <table border="0" cellpadding="0" cellspacing="0" runat="server" id="botonesInsertar"
                                    visible="false">
                                    <tr>
                                        <td valign="top">
                                            <img alt="Guardando..." src="../images_diseno/bt_guardar_OFF.png" border="0" style="display: none;"
                                                id="cmdInsertarBlanco" />
                                            <asp:ImageButton AlternateText="Insertar" ImageUrl="../images_diseno/bt_guardar.png"
                                                OnClick="cmdInsertar_Click" CommandName="Insertar" ID="cmdInsertar" runat="server"
                                                OnClientClick="return realizarValidacion();" />
                                        </td>
                                        <td valign="top">
                                            <img alt="" src="../images_diseno/bt_separador.png" />
                                            <asp:ImageButton AlternateText="Cancelar" ImageUrl="../images_diseno/bt_cancelar.png"
                                                CommandName="CancelarInsertando" ID="cmdCancelar" runat="server" OnClick="cmdCancelar_Click"
                                                CausesValidation="false" />
                                        </td>
                                    </tr>
                                </table>
                                <table border="0" cellpadding="0" cellspacing="0" runat="server" id="botonesSeleccionar"
                                    visible="true">
                                    <tr>
                                        <td valign="top">
                                            <asp:ImageButton AlternateText="Editar" ImageUrl="../images_diseno/bt_editar.png"
                                                CommandName="Edit" CausesValidation="false" ID="cmdEditar" runat="server" OnClick="cmdEditar_Click" />
                                        </td>
                                        <td valign="top">
                                            <img alt="" src="../images_diseno/bt_separador.png" />
                                            <asp:ImageButton AlternateText="Borrar" ImageUrl="../images_diseno/bt_eliminar.png"
                                                OnClick="cmdBorrar_Click" CommandName="Baja" CausesValidation="false" ID="cmdBorrar"
                                                runat="server" OnClientClick="return ConfirmarBorrado(this);" />
                                        </td>
                                    </tr>
                                </table>
                                <table border="0" cellpadding="0" cellspacing="0" runat="server" id="botonesEditar"
                                    visible="false">
                                    <tr>
                                        <td valign="top">
                                            <asp:ImageButton AlternateText="Actualizar" ImageUrl="../images_diseno/bt_guardar.png"
                                                CommandName="Editar" ID="cmdActualizar" runat="server" OnClick="cmdActualizar_Click" />
                                        </td>
                                        <td valign="top">
                                            <img alt="" src="../images_diseno/bt_separador.png" />
                                            <asp:ImageButton AlternateText="Cancelar" ImageUrl="../images_diseno/bt_cancelar.png"
                                                OnClick="cmdCancelar2_Click" CommandName="Cancel" ID="cmdCancelar2" runat="server"
                                                CausesValidation="false" />
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </asp:Panel>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </asp:Panel>
            <asp:HiddenField ID="hdDatosGeneralesEditando" runat="server" />
            <asp:HiddenField ID="hdGuardarCambios" runat="server" />
            <asp:HiddenField ID="hdUltimaFichaVista" runat="server" />
            <asp:HiddenField ID="hdMantenimientoActualizado" runat="server" />
            <asp:HiddenField ID="hdIdRegistro" runat="server" />
            <asp:HiddenField ID="hdFiltro" runat="server" />
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdateProgress ID="upIndicadorUpdate" AssociatedUpdatePanelID="upPrincipal"
        runat="server">
        <ProgressTemplate>
            <div class="IndicadorProgreso">
                <img src="../images_diseno/ajax-loader.gif" alt="Cargando..." id="loadingimage" class="TotalmenteCentrado" />
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
    <telerik:RadCodeBlock ID="rcbCodigoCliente" runat="server">
 
        <script type="text/javascript">
 
            function InsertNewItem() {
                var listView = $find("<%= rlvListado.ClientID %>");
                listView.insertItem();
            }
             
            function deseleccionar(sender, eventArgs) {
                if (sender) {
                    var hdIdRegistro = document.getElementById('<%= hdIdRegistro.ClientID %>');
                    if (hdIdRegistro) {
                        hdIdRegistro.value = '';
                    }
                }
            }
 
            function comprobarNoElementosSinGuardar(indexFichaSeleccionada) {
                var elementosSinGuardar = false
                var vista = document.getElementById('<%=hdUltimaFichaVista.ClientID%>');
                if (vista.value == '') {
                    vista.value = '0';
                }
                var EditandoDatosGenerales = document.getElementById('<%=hdDatosGeneralesEditando.ClientID%>');
 
                // En caso de que sea la ficha 0 (Datos Generales) comprobamos que el resto de fichas no esten en edicion
                if (vista.value == 0 && indexFichaSeleccionada != 0) {
                    if (EditandoDatosGenerales.value == 'true') {
                        elementosSinGuardar = true;
                    }
                }
                return elementosSinGuardar;
            }
 
            var isTabClicked = false;
            var tabPulsado;
 
            function onTabSelecting(sender, args) {
                var multiPagina = document.getElementById('<%=ContenidoPestanyas.ClientID%>');
                var tabOriginal = sender.get_selectedTab();
                tabPulsado = args.get_tab();
                if (tabOriginal) {
                    var valorOriginal = tabOriginal.get_value();
                }
                else {
                    var valorOriginal = 0;
                }
                var vista = document.getElementById('<%=hdUltimaFichaVista.ClientID%>');
                vista.value = valorOriginal;
                if ((isTabClicked == false) && (comprobarNoElementosSinGuardar(tabPulsado.get_value()))) {
                    var oWnd = window.radopen('../controles/alertas.aspx?msg=' + '1', 'Alerta de Guardado');
                    // Opens the window
                    oWnd.add_close(cierreConfirmacionTabSelecting);
                    // set a function to be called when RadWindow is closed
                    args.set_cancel(true);
                }
                else {
                    isTabClicked = false
                    return true;
                }
            }
 
            function cierreConfirmacionTabSelecting(oWnd, args) {
                isTabClicked = true;
                oWnd.setUrl("about:blank");
                // Sets url to blank
                oWnd.remove_close(CierreConfirmacionSeleccion);
                // remove the close handler - it will be set again on the next opening
                var arg = args.get_argument();
                if (arg) {
                    var EditandoDatosGenerales = document.getElementById('<%=hdDatosGeneralesEditando.ClientID%>');
                    var bt = arg.boton
                    var hdGuardarCambios = document.getElementById('<%=hdGuardarCambios.ClientID%>');
 
                    switch (bt) {
                        case 1:
                            // botonpulsado = 'Si';
                            var hdGuardarCambios = document.getElementById('<%=hdGuardarCambios.ClientID%>');
                            if (hdGuardarCambios) {
                                hdGuardarCambios.value = 'true';
                                if (tabPulsado) {
                                    tabPulsado.click();
                                }
                            }
                            break;
                        case 2:
                            // botonpulsado = 'No';
                            EditandoDatosGenerales.value = 'false';
                            if (hdGuardarCambios) {
                                hdGuardarCambios.value = 'false';
                                var botonCancelar = document.getElementById('<%=cmdCancelar2.ClientID %>');
                                if (botonCancelar) {
                                    botonCancelar.click();
                                }
                                if (tabPulsado) {
                                    tabPulsado.click();
                                }
                            }
                            break;
                        case 3:
                            // botonpulsado = 'Cancelar';
                            isTabClicked = false;
                            break;
                    }
                }
            }
 
            function realizarValidacion(nombreGrupoValidacion) {
                if ((nombreGrupoValidacion == null) || (nombreGrupoValidacion == '')) {
                    Page_ClientValidate();
                }
                else {
                    Page_ClientValidate(nombreGrupoValidacion);
                }
                if (Page_IsValid) {
                    return true;
                }
                else {
                    return false;
                }
            }
 
            var botonSeleccion = null;
            var confirmacionSeleccion = false;
 
            function ConfirmarSeleccion(sender) {
                if (confirmacionSeleccion == false) {
                    botonSeleccion = sender;
 
                    var elementosSinGuardar = false
                    var EditandoDatosGenerales = document.getElementById('<%=hdDatosGeneralesEditando.ClientID%>');
 
                    if (EditandoDatosGenerales.value == 'true') {
                        elementosSinGuardar = true;
                    }
 
                    if (elementosSinGuardar) {
 
                        var oWnd = window.radopen('../controles/alertas.aspx?msg=' + '1', 'Alerta de Guardado');
                        // Opens the window
                        oWnd.add_close(CierreConfirmacionSeleccion);
                        // set a function to be called when RadWindow is closed
                        return false;
                    }
                    else {
                        confirmacionSeleccion = false;
                        return true;
                    }
                }
                else {
                    confirmacionSeleccion = false;
                    return true;
                }
            }
 
            function CierreConfirmacionSeleccion(oWnd, args) {
                confirmacionSeleccion = true;
                oWnd.setUrl("about:blank");
                // Sets url to blank
                oWnd.remove_close(CierreConfirmacionSeleccion);
                // remove the close handler - it will be set again on the next opening
                var arg = args.get_argument();
                var boton;
                var EditandoDatosGenerales = document.getElementById('<%=hdDatosGeneralesEditando.ClientID%>');
 
                if (arg) {
                    var bt = arg.boton
                    var hdGuardarCambios = document.getElementById('<%=hdGuardarCambios.ClientID%>');
 
                    switch (bt) {
                        case 1:
                            // botonpulsado = 'Si';
                            var hdGuardarCambios = document.getElementById('<%=hdGuardarCambios.ClientID%>');
                            if (hdGuardarCambios) {
                                hdGuardarCambios.value = 'true';
                                if (botonSeleccion) {
                                    botonSeleccion.click();
                                }
                            }
                            break;
                        case 2:
                            // botonpulsado = 'No';
                            EditandoDatosGenerales.value = 'false';
                            if (hdGuardarCambios) {
                                hdGuardarCambios.value = 'false';
                                if (botonSeleccion) {
                                    botonSeleccion.click();
                                }
                            }
                            break;
                        case 3:
                            // botonpulsado = 'Cancelar';
                            confirmacionSeleccion = false;
                            break;
                        case 4:
                            // botonpulsado = 'Aceptar';
                            var hdGuardarCambios = document.getElementById('<%=hdGuardarCambios.ClientID%>');
                            if (hdGuardarCambios) {
                                hdGuardarCambios.value = 'true';
                                if (botonSeleccion) {
                                    botonSeleccion.click();
                                }
                            }
                            break;
                    }
                }
            }
 
        </script>
 
    </telerik:RadCodeBlock>
    </form>
</body>
</html>

Child page codebehind:

Imports Telerik.Web.UI
 
Partial Public Class Listado
    Inherits Raiz
 
 
    Protected Sub cmdBuscar_Click(ByVal origen As Object, ByVal argumentos As ImageClickEventArgs)
        CancelarCambios()
        VerSeccionDcha(False)
        Dim aux As Control = If(rlvListado Is Nothing, Nothing, rlvListado.FindControl("txtBuscar"))
        If aux IsNot Nothing Then
            Dim texto As String = CType(aux, RadTextBox).Text
            If texto IsNot Nothing Then
                hdFiltro.Value = texto
                CargarListado(texto)
            End If
        End If
        actualizarPaneles()
    End Sub
 
    Protected Overrides Sub cmdBorrar_Click(ByVal origen As Object, ByVal argumentos As System.Web.UI.ImageClickEventArgs)
        MyBase.cmdBorrar_Click(origen, argumentos)
        actualizarPaneles()
    End Sub
 
    Protected Overrides Sub cmdActualizar_Click(ByVal origen As Object, ByVal argumentos As System.Web.UI.ImageClickEventArgs)
        MyBase.cmdActualizar_Click(origen, argumentos)
        actualizarPaneles()
    End Sub
 
    Protected Overrides Sub cmdCancelar_Click(ByVal origen As Object, ByVal argumentos As System.Web.UI.ImageClickEventArgs)
        MyBase.cmdCancelar_Click(origen, argumentos)
        Cierra()
        actualizarPaneles()
    End Sub
 
    Protected Sub CargarListado(ByVal origen As Object, ByVal argumentos As RadListViewNeedDataSourceEventArgs) Handles rlvListado.NeedDataSource
        Dim filtro As String = String.Empty
        If hdFiltro IsNot Nothing AndAlso Not hdFiltro.Value.Equals(String.Empty) Then
            filtro = hdFiltro.Value
        End If
        CargarListado(filtro)
    End Sub
 
    Protected Overridable Sub CargarListado(ByVal FiltroDescripcion As String)
        ' Inserting some elements in the radlistview
        '
        'Dim lista As New List(Of ListItem)
        'lista.Add(New ListItem("Texto", "1"))
        'lista.Add(New ListItem("Text", "2"))
        'lista.Add(New ListItem("Contenido", "3"))
        'If FiltroDescripcion IsNot Nothing AndAlso Not FiltroDescripcion.Equals(String.Empty) Then
        '    lista = (From p In lista Where p.Text.ToUpper.Contains(FiltroDescripcion.ToUpper)).ToList
        'End If
        'rlvListado.DataSource = lista
 
        ' Inserting an empty list of items in the radlistview
        rlvListado.DataSource = New List(Of ListItem)
    End Sub
 
    Protected Overrides Sub Orden(ByVal origen As Object, ByVal argumentos As CommandEventArgs)
        MyBase.Orden(origen, argumentos)
        Select Case argumentos.CommandName
            Case "Select"
                rlvListado.InsertItemPosition = RadListViewInsertItemPosition.None
                actualizarPaneles()
            Case "InitInsert"
                MyBase.cmdNuevo_Click(origen, Nothing)
                rlvListado.SelectedIndexes.Clear()
                rlvListado.InsertItemPosition = InsertItemPosition.FirstItem
                actualizarPaneles()
        End Select
    End Sub
 
#Region " POSICIONAMIENTO LISTVIEW  "
 
    Protected Sub Nuevo()
        rlvListado.SelectedIndexes.Clear()
        rlvListado.InsertItemPosition = InsertItemPosition.FirstItem
    End Sub
 
    Protected Sub Cierra()
        CancelarCambios()
        rlvListado.SelectedIndexes.Clear()
        rlvListado.InsertItemPosition = InsertItemPosition.None
        hdIdRegistro.Value = ""
        VerSeccionDcha(False)
        actualizarPaneles()
    End Sub
 
    Protected Sub CambioSelect(ByVal origen As Object, ByVal argumentos As EventArgs)
        rlvListado.InsertItemPosition = InsertItemPosition.None
    End Sub
 
#End Region
 
    Protected Overridable Sub page_loadcomplete() Handles Me.LoadComplete
        If rlvListado.InsertItemPosition = RadListViewInsertItemPosition.LastItem Then
            rlvListado.InsertItemPosition = RadListViewInsertItemPosition.FirstItem
        End If
    End Sub
 
    Protected Sub hdIdRegistro_ValueChanged(ByVal origen As Object, ByVal argumentos As EventArgs) Handles hdIdRegistro.ValueChanged
        If hdIdRegistro.Value.Equals(String.Empty) Then
            CancelarCambios()
            rlvListado.SelectedIndexes.Clear()
            rlvListado.InsertItemPosition = InsertItemPosition.None
            VerSeccionDcha(False)
            actualizarPaneles()
        End If
    End Sub
 
    Protected Sub pruebaInsercion(ByVal origen As Object, ByVal argumentos As EventArgs) Handles rlvListado.ItemInserting, rlvListado.ItemInserted
        Dim parar As Boolean = True
    End Sub
End Class
Veli
Telerik team
 answered on 24 Aug 2010
1 answer
96 views
Hello,

Is it possible to drag RadGrid items to the RadListView control?

Thanks.
Rosen
Telerik team
 answered on 24 Aug 2010
1 answer
257 views
Hello,

In my current project I am using the RadWindow object quite a bit and I am running into a lot of trouble with it.

One page in my project calls the RadWindow object twice. The RadWindow populate data in a radgrid and on the select command of the grid the RadWindow should close. The RadWindow is called from server side code.

The issue I have noticed is that when I first load the page and make the RadWindow call, the RadWindow page_load event gets called once, the next time I call the RadWindow object from another location on the same page, the page_load of the RadWindow triggers twice. The page_load triggers as many times as I call the RadWindow object from the page.

Combine the above with the radgrid select. If the radwindow page_load happens twice then the radgrid select happens twice. The normal behavior of select in my code is to pass the selected item to the parent page and close the RadWindow and return to the parent control. However the select of the radgrid triggers as many times as the page_load event triggers.

Could you please let me know how to handle this scenario.

Thanks!!

Below are snippets of my code.
Parent page from where the RadWindow is loaded.
<telerik:RadWindowManager runat="server" ID="WindowMgr" Skin="abc" EnableEmbeddedSkins="false"
</telerik:RadWindowManager>

Javascript on the parent page to handle the OnClientClose event.
<script type="text/javascript">
        function SetTextBoxValue(oWnd, args) {
            //check if a value is returned from the dialog           
            var arg = args.get_argument();
            if (arg) {
                //do something
            }
        }
</script>

Code to invoke the RadWindow server side
Dim popUp As Telerik.Web.UI.RadWindow = New Telerik.Web.UI.RadWindow()
popUp.ID = "selectOrg"
popUp.OnClientClose = "SetTextBoxValue"
popUp.NavigateUrl = "someurl"
popUp.VisibleOnPageLoad = True
popUp.EnableEmbeddedSkins = False
popUp.Skin = "abc"
popUp.VisibleStatusbar = False
popUp.VisibleTitlebar = False
popUp.Modal = True
popUp.Behaviors = Telerik.Web.UI.WindowBehaviors.None
popUp.ShowContentDuringLoad = True
popUp.Height = Unit.Pixel(450)
popUp.Width = Unit.Pixel(500)
 
WindowMgr.Windows.Add(popUp)

Code in the select index changed event for the radgrid in the radwindow
ClientScript.RegisterStartupScript(Page.GetType(), "ey", "returnToParent('" + strSomeValue + "');", True)

Javascript code to handle the returntoParent function of the radwindow
function returnToParent(refControl) {
    //create the argument that will be returned to the parent page
    var oArg = new Object();
 
    //get the control to modify on Parent
    oArg.ControlToModify = refControl
 
    //get a reference to the current RadWindow
    var oWnd = GetRadWindow();
 
    //Close the RadWindow and send the argument to the parent page
    if (oArg.ControlToModify) {
        oWnd.close(oArg);
    }
}
Georgi Tunev
Telerik team
 answered on 24 Aug 2010
1 answer
307 views
Hi,

I have a page with several RadComboBoxes.

Each combobox filters on the text that is typed (for instance, I type "er", eric, frederic, meredith appear in the dropdown).

That poses a usability problem when a user wants to select another item in the list, the other items are not visible when some text is typed in the combobox. Each time, the user has to manually select the filter text and delete it. Is there a clean (preferably built-in) way of clearing the text in a RadComboBox ? (a "clear selection" option in the dropdown, a "X" button on the selecteditemtemplate field ?

Thank you,

Eric

Simon
Telerik team
 answered on 24 Aug 2010
6 answers
220 views
I have the following situation:

I have a radmenu being used as a context menu on a radtreeview.  When the user clicks (or right clicks) on a node in the treeview, the node is then selected and I need to retrieve some data from the database to populate some textboxes with data relevent to the newly selected node.

The problem I am having is that, of course, when the page is posted back, my context menu is then closed.  I am trying to use the menu.show command, but it wants a dom event as a parameter. In other places I've just used the args.get_DomEvent to grab the event off of the event arguments parameters that are sent to the method.  But, I don't have an "event arguments" parameter if I'm trying to just register a script to open the menu as soon as the page gets done loading.

how can I reshow my menu after the page refreshes following a postback?
Tonino
Top achievements
Rank 1
 answered on 24 Aug 2010
1 answer
72 views
I need to update a legacy Web App using Telerik RadControls for ASP.NET Q3 2007, I have later versions Q3 2009, Q1 2010 and Q2 2010 also installed, I get an exception on installing Q3 2007, 'Error creating virtual directories, Exception details: Unknown Error(0x80005000). Has anyone else experienced this problem and found a workaround? I am using VS2008, I also have VS2010 installed. I have tried uninstalling the later versions first, but installation of Q3 2007 still fails.
Georgi Tunev
Telerik team
 answered on 24 Aug 2010
1 answer
96 views
Hello Telerik,

I'm not sure if you're aware of the issue described here:

http://brianseekford.com/index.php/2010/04/18/bit-by-telerik-redirects-in-my-ajax-panel-not-working-with-net-4-upgrade/

I had the same issue till the moment and removing RadCompression fixed it. I hope that helps someone and hope you're fixing the issue soon. 

Regards,
Apostol Apostolov 

P.S. Sorry for the thread's name, I got distracted.
Sebastian
Telerik team
 answered on 24 Aug 2010
3 answers
140 views
Hello, I am trying to download a file from SQL Server...here is the method I normally use.
Private Sub gvMain_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles gvMain.ItemCommand
      If e.CommandName = "DownLoad" Then
 
          sch = New clsReport
          Dim arr As ArrayList = sch.DownloadLetter(e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("ID"))
 
          Dim fil As Byte() = arr(0)
          Dim nam As String = arr(1)
          Dim ext As String = arr(2)
 
          If Not fil Is Nothing Then
              Response.Clear()
              Response.AddHeader("Content-Dispostiotion", nam & "." & ext)
              Response.AddHeader("Content-Length", fil.Length.ToString)
              Response.ContentType = "application/octet-stream"
              Response.BinaryWrite(fil)
              
          End If
      End If
 
 
 
  End Sub

Do I need to do something with the RadAjaxManager here...or the RadScriptManager? 
Thanks for any help.
Kiara
Top achievements
Rank 1
 answered on 24 Aug 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?