call a code behind function from RadWindow

2 posts, 1 answers
  1. Christian
    Christian avatar
    97 posts
    Member since:
    Mar 2009

    Posted 05 May 2009 Link to this post

    Hello,

    in my applikation I need in my RadWindow to call a a code behind function in the window which has opened this RadWindow.

    How can I do this?

    thanks

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

    Posted 05 May 2009 Link to this post

    Hello Christian,

    Try out the following code snippet for achieving this. Here I have used button control in parent page to do PostBack from client function (which is called from the radwindow page).

    Parent Page:
    aspx:
     
    <telerik:radwindowmanager id="RadWindowManager1" runat="server"
    <Windows> 
    <telerik:RadWindow runat="server" NavigateUrl="Window.aspx" OpenerElementID="Button2" Behavior="Default"></telerik:RadWindow> 
    </Windows> 
    </telerik:radwindowmanager> 
    <asp:Button ID="Button2" runat="server" Text="Open Window" /> 
    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /> 

    javascript:
     
    <script type="text/javascript"
    function callServerfunction() 
       __doPostBack("Button1""");    // Fire ButtonClick event 
    function __doPostBack(eventTarget, eventArgument) 
         document.form1.__EVENTTARGET.value = eventTarget; 
         document.form1.__EVENTARGUMENT.value = eventArgument; 
         document.form1.submit(); 
    </script> 

    cs:
     
    protected void Button1_Click(object sender, EventArgs e) 
        // Do somthing , call any other function 

    Page opened in RadWindow:
    aspx:
     
    <input id="Button1" type="button" value="button" onclick="postbackParent();"/> 

    javascript:
     
    <script type="text/javascript"
    function postbackParent() 
        var oBrowserWnd = GetRadWindow().BrowserWindow; 
        oBrowserWnd.callServerfunction(); 
    function GetRadWindow() 
      var oWindow = null
      if (window.radWindow) 
         oWindow = window.radWindow; 
      else if (window.frameElement.radWindow) 
         oWindow = window.frameElement.radWindow; 
      return oWindow; 
    </script> 

    Thanks,
    Shinu.
Back to Top