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

Close radwindows with button without postback

1 Answer 189 Views
Window
This is a migrated thread and some comments may be shown as answers.
Fabio Cirillo
Top achievements
Rank 1
Fabio Cirillo asked on 08 Jan 2013, 09:32 AM
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

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 09 Jan 2013, 02:36 PM
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.
Tags
Window
Asked by
Fabio Cirillo
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or