Close radwindows with button without postback

2 posts, 0 answers
  1. Fabio Cirillo
    Fabio Cirillo avatar
    180 posts
    Member since:
    Jan 2010

    Posted 08 Jan 2013 Link to this post

    Hi guys,
    i've created this radwinodw on my webpage:
    <telerik:RadWindow ID="RadWindowChangepwd" runat="server" ShowContentDuringLoad="false" Width="360px"
    Height="220px" Title="Cambio password" Behaviors="None" Modal="True" Behavior="None"
    Font-Names="Verdana" Font-Size="Small" IconUrl="/image/iconlogo.png" VisibleStatusbar="False"
    Skin="Simple" ReloadOnShow="True">
    <ContentTemplate>
    <div class="Divchangepwd">
    <div class="Divchangepwd1">
    <telerik:RadAjaxPanel ID="RadAjaxPanelpwd" runat="server">
    <table style="width:100%;">
    <tr>
    <td colspan="2" style="padding-left: 10px; padding-top: 10px">
    <telerik:RadTextBox ID="Txtpwdnow" Runat="server" Label=" Password attuale:"
    LabelWidth="110px" MaxLength="20" TextMode="Password" Width="300px">
    </telerik:RadTextBox>
    </td>
    </tr>
    <tr>
    <td colspan="2" style="padding-left: 10px">
    <telerik:RadTextBox ID="Txtpwdnew" Runat="server" Label="Nuova password:"
    LabelWidth="110px" MaxLength="20" TextMode="Password" Width="300px">
    </telerik:RadTextBox>
    </td>
    </tr>
    <tr>
    <td colspan="2" style="padding-left: 10px">
    <telerik:RadTextBox ID="Txtpwdnewconf" Runat="server"
    Label="Conferma password:" LabelWidth="110px" MaxLength="20"
    TextMode="Password" Width="300px" AutoPostBack="False">
    </telerik:RadTextBox>
    </td>
    </tr>
    <tr>
    <td colspan="2" style="padding-left: 10px; padding-top:15px">
    </td>
    </tr>
    <tr>
    <td align="center">
    <asp:ImageButton ID="Imgbtnconfermapwd" runat="server" ImageUrl="~/Image/conferma.png" OnClientClick="return CallNotification()" />
    </td>
    <td align="center">
    <asp:ImageButton ID="ImgBtnClosepwd" runat="server" ImageUrl="~/Image/esci1.png" />
    </td>
    </tr>
    </table>
    </telerik:RadAjaxPanel>
    </div>
    </div>
    </ContentTemplate>
    </telerik:RadWindow>



    when i press the imagebutton "imgBtnclosepwd" star the postback. Is possibile with javascript code close the radwindows without postback? I usede this code too but there's erro when close radwindow:

    function GetRadWindow() {
        var oWindow = null;
        if (window.radWindow) oWindow = window.radWindow;
        else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
        return oWindow;
    }
    function Close() {
        GetRadWindow().close();
    }

    Bye
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 09 Jan 2013 Link to this post

    Hello Fabio,

    The code you have pasted is used to get a reference to the RadWindow from inside its content page. You are, however, using the ContentTemplate, so a different approach should be used for getting the reference. More on the difference between these modes and examples on closing them is available here: http://demos.telerik.com/aspnet-ajax/window/examples/contenttemplatevsnavigateurl/defaultcs.aspx.

    Put shortly:
    function closeMyRadWindow(){
        $find("<%=RadWindowChangepwd.ClientID%>").close();
        return false;
    }


    Greetings,
    Marin Bratanov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top