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

Is there any event for close button?

3 Answers 437 Views
Window
This is a migrated thread and some comments may be shown as answers.
Tarulatta Patel
Top achievements
Rank 1
Tarulatta Patel asked on 25 Mar 2009, 03:49 PM

Hi,

 

I have Radwindow on my page. It has close (“X”) image on top right most corner. When user closes window by clicking on this close image, I want to clear some of the controls from parent page. But I do not know how to capture the event and perform action on it.

 

Is it possible to capture the event when they click the Close ("X") image button?

 

Thanks.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 26 Mar 2009, 11:26 AM
Hello Tarunlata Patel,

The client side event OnClientClose will fire when closing the RadWindow. If you want to execute server side event when closing the RadWindow, one suggestion is adding an invisible button on page and raise the postback for the button from client side. See the example.

CSS:
<style type="text/css"
.Button 
    displaynone
}     
</style> 

ASPX:
<telerik:RadWindowManager ID="RadWindowManager1" runat="server"
<Windows> 
    <telerik:RadWindow runat="server" NavigateUrl="Window.aspx" OnClientClose="OnClientClose" ID="Window1" OpenerElementID="Button1" ></telerik:RadWindow> 
</Windows> 
</telerik:RadWindowManager> 
<input id="Button1" type="button" value="button" /> 
<asp:Button ID="Button2" runat="server" Text="Button" OnClick="Button2_Click" CssClass="Button" /> 

JavaScript:
<script type="text/javascript"
function OnClientClose() 
    __doPostBack('Button2',''); 
</script> 

CS:
protected void Button2_Click(object sender, EventArgs e) 
   // Clear the controls 

Thanks,
Shinu.
0
FAR
Top achievements
Rank 1
answered on 17 Nov 2009, 11:52 AM
Hi, i've tested this, but i have a problem, the postback is ok, but the event doesn't fire.

i've tested all thoses 3 js
function OnListeMetierClose() { 
                document.all("<%= PopUpClose_Btn.ClientID %>").click(); 
            } 
 
 
function OnListeMetierClose() { 
                __dopostback('PopUpClose_Btn',''); 
            } 
 
function OnListeMetierClose() { 
                __dopostback('<%=PopUpClose_Btn.ClientID%>',''); 
            } 

   <asp:Button ID="PopUpClose_Btn" OnClick="PopUpClose_Btn_Click" CssClass="InvisibleButton" runat="server"/> 

protected void PopUpClose_Btn_Click(object sender, EventArgs e) 
        { 
          // my code (but the event is not fired) 
        } 

I  enter in the Javascript function, a postback is done, but i never enter in the eventhandler....
What am i Missing ?


0
Georgi Tunev
Telerik team
answered on 17 Nov 2009, 12:37 PM
Hi FAR,

Please note that JavaScript is case - sensitive. More information about __doPostBack is available in various resources on the Net. I believe that the following article will be of help:
http://aspalliance.com/895_Understanding_the_JavaScript___doPostBack_Function.all

For example you could try one of the following approaches

function OnListeMetierClose()
{
    //one way
    //document.getElementById("<%= PopUpClose_Btn.ClientID %>").click();
 
    //another
    var button = document.getElementById("<%= PopUpClose_Btn.ClientID %>");
    __doPostBack(button.name, "");
     
}




Kind regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Window
Asked by
Tarulatta Patel
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
FAR
Top achievements
Rank 1
Georgi Tunev
Telerik team
Share this question
or