Is there any event for close button?

4 posts, 0 answers
  1. Tarulatta Patel
    Tarulatta Patel avatar
    14 posts
    Member since:
    Jul 2008

    Posted 25 Mar 2009 Link to this post

    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.

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 26 Mar 2009 Link to this post

    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.
  3. FAR
    FAR avatar
    26 posts
    Member since:
    May 2009

    Posted 17 Nov 2009 Link to this post

    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 ?


  4. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 17 Nov 2009 Link to this post

    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.
Back to Top