I open a RadWindow where the user provides data and then presses an OK button.  On postback, the data is processed and a status is generated.  I'm trying to show that status via a notification popup on the main page that opened the window.  
I modified this example for my purposes so that I can pass the result back: http://www.telerik.com/forums/refresh-radgrid-on-close-of-radwindow
The problem is that the AjaxRequest event fires before the OK button click and so the status is unknown at this point. Is there another scenario I can use to pass a value back server side?
                                I modified this example for my purposes so that I can pass the result back: http://www.telerik.com/forums/refresh-radgrid-on-close-of-radwindow
The problem is that the AjaxRequest event fires before the OK button click and so the status is unknown at this point. Is there another scenario I can use to pass a value back server side?
4 Answers, 1 is accepted
0
                                
                                                    Shinu
                                                    
                                            
    Top achievements
    
            
                 Rank 2
                Rank 2
            
    
                                                
                                                answered on 28 Aug 2014, 05:40 AM
                                            
                                        Hi Jon,
Please have a look into the sample code snippet which works fine at my end.
ASPX:
C#:
Please elaborate your requirement if it doesn't help.
Thanks,
Shinu.
                                        Please have a look into the sample code snippet which works fine at my end.
ASPX:
<telerik:RadButton ID="rbtnOpenWin" runat="server" Text="Open"></telerik:RadButton><asp:Label ID="lblNewValue" runat="server"></asp:Label><telerik:RadWindow ID="rwindow" runat="server" OpenerElementID="rbtnOpenWin">    <ContentTemplate>        <asp:TextBox ID="txtValue" runat="server">        </asp:TextBox>        <asp:Button ID="btnOk" runat="server" Text="OK" OnClick="btnOk_Click" />    </ContentTemplate></telerik:RadWindow>C#:
protected void btnOk_Click(object sender, EventArgs e){    lblNewValue.Text = txtValue.Text;}Please elaborate your requirement if it doesn't help.
Thanks,
Shinu.
0
                                
                                                    Jon
                                                    
                                            
    Top achievements
    
            
                 Rank 1
                Rank 1
            
    
                                                
                                                answered on 28 Aug 2014, 07:45 AM
                                            
                                        I'm trying to pass a value back to the main window and so I modified the code in the example I sited.  So the basic flow of events is:
* RadWindow opens
* User enters data and pushes OK which causes a PostBack and the window closes.
* The window's OK button event produces the value that is then passed back which drives a Notification popup and what the AjaxManager causes to update.
According to the code in the example I sited, I added this javascript and added OnClientClose="closeRadWindow" to the RadWindow.
       
I'm then using the AjaxManager to drive the notification popup. The problem is that ajaxRequest fires before OKButton_Click. Is there another way for me to pass a value back to the main window after the OK button has finished processing and force the window to fire an event?
                                        * RadWindow opens
* User enters data and pushes OK which causes a PostBack and the window closes.
* The window's OK button event produces the value that is then passed back which drives a Notification popup and what the AjaxManager causes to update.
According to the code in the example I sited, I added this javascript and added OnClientClose="closeRadWindow" to the RadWindow.
<script type="text/javascript"><br>            
function closeRadWindow() {                
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest(); 
           }
</script>I'm then using the AjaxManager to drive the notification popup. The problem is that ajaxRequest fires before OKButton_Click. Is there another way for me to pass a value back to the main window after the OK button has finished processing and force the window to fire an event?
0
                                
                                                    Jon
                                                    
                                            
    Top achievements
    
            
                 Rank 1
                Rank 1
            
    
                                                
                                                answered on 28 Aug 2014, 08:02 AM
                                            
                                        Ok...I see the real problem.  The window being opened is actually another page and so the controls and events are separated.  Is there a way to do it with the structure I have or do I need to move the controls on the other page into the window control?
                                        0
                                
                                                    Shinu
                                                    
                                            
    Top achievements
    
            
                 Rank 2
                Rank 2
            
    
                                                
                                                answered on 29 Aug 2014, 05:10 AM
                                            
                                        Hi Jon,
Please have a look into the sample code snippet to achieve your scenario.
Main Page ASPX:
Main Page JavaScript:
Window Page ASPX:
Window Page JavaScript:
Thanks,
Shinu.
                                        Please have a look into the sample code snippet to achieve your scenario.
Main Page ASPX:
<telerik:RadTextBox ID="txtValueFromWindow" runat="server"></telerik:RadTextBox><telerik:RadButton ID="rbtnOpenWin" runat="server" Text="Open" AutoPostBack="false"    OnClientClicked="openWindow"></telerik:RadButton><telerik:RadWindowManager ID="RadWindowManager1" runat="server" OnClientClose="OnClientClose"></telerik:RadWindowManager>Main Page JavaScript:
function openWindow() {    radopen("WindoePage.aspx");}function OnClientClose(oWnd, args) {    var arg = args.get_argument();    if (arg) {        var txtValue = arg.txtValue;        $find("<%=txtValueFromWindow.ClientID%>").set_value(txtValue);    }}Window Page ASPX:
<telerik:RadTextBox ID="txtValue" runat="server"></telerik:RadTextBox><telerik:RadButton ID="rbtnOk" runat="server" Text="OK" AutoPostBack="false" OnClientClicked="returnToParent"></telerik:RadButton>Window Page JavaScript:
function returnToParent() {    var oArg = new Object();    oArg.txtValue = $find("<%=txtValue.ClientID %>").get_value();    var oWnd = GetRadWindow();    if (oArg.txtValue) {        oWnd.close(oArg);    }}function GetRadWindow() {    var oWindow = null;    if (window.radWindow) oWindow = window.radWindow;    else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;    return oWindow;}Thanks,
Shinu.