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

[Solved] How do I set the return value in my new window?

10 Answers 439 Views
Window
This is a migrated thread and some comments may be shown as answers.
Darryl Barney
Top achievements
Rank 1
Darryl Barney asked on 06 May 2008, 02:49 AM
Hello,

I must be missing something, because with all the searching I have done, i cannot seem to find what code I must set in my new window, so that I can return a specified value to the origin.

I am creating a popup where a user will create a serial number AND/OR set a serial number. I am just trying to figure out how, when the window is closed, I specify the variable returned.

Thanks!

10 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 08 May 2008, 01:54 PM
Hi Darryl Barney,

I believe that the Returning Values From A Dialog and Communication Between RadWindows demos will be of help in your case. Please check the code provided in the demos and the Controls / RadWindow / Programming / Using RadWindow as a Dialog topic in the documentation for additional details.



All the best,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Darryl Barney
Top achievements
Rank 1
answered on 13 May 2008, 02:05 AM
I must be missing something.

Here is what I have, but i cannot get any value...

Popup:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Equip_Omega_Serial.aspx.vb" Inherits="Equip_Omega_Serial" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server">  
    <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server">  
    <div> 
        <asp:TextBox ID="test" runat="server">12345</asp:TextBox> 
    </div> 
    </form> 
</body> 
</html> 
 


Parent:
    <script type="text/javascript">  
    //<![CDATA[
    function openSerial()
    {
        var oWnd = window.radopen(null, "Side_Serial");
        oWnd.setSize(500,340);
        oWnd.add_close(OnClientClose);
    }
    function OnClientClose(oWnd)
    {
        alert(oWnd.Argument.Test);
    }
    //]]> 
    </script> 
    <radW:RadWindowManager ID="RadWindowManager1" runat="server">  
        <Windows> 
            <radW:RadWindow ID="Side_Serial"   
                    NavigateUrl="equip_Omega_Serial.aspx" 
                    VisibleOnPageLoad="false"   
                    VisibleStatusbar="true"   
                    VisibleTitlebar="true" 
                    OnClientClose="OnClientClose" 
                    Skin="Default" /> 
        </Windows> 
    </radW:RadWindowManager> 
     
0
Georgi Tunev
Telerik team
answered on 13 May 2008, 12:43 PM
Hello Darryl,

You are missing the code in the dialog window - it is described in the documentation ( Controls / RadWindow / Programming / Using RadWindow as a Dialog topic). For convenience I am sending you the files from the demo.



Regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Darryl Barney
Top achievements
Rank 1
answered on 14 May 2008, 12:00 AM

Thanks.

I tried that out, and though progress was made....i could not get it to work. I get a javascript error everytime.  The error: Object doesnt support this property or method. I do not get this error in a popup, but in the corner of IE. Also, it has the dialogue url specified as the origin of the error.

Dialogue:

<body onload="ConfigureDialog()">  
    <form id="form1" runat="server">  
    <script type="text/javascript">  
        //This code is used to provide a reference to the radwindow "wrapper"  
        function GetRadWindow()  
        {  
            var oWindow = null;  
            if (window.radWindow) oWindow = window.radWindow;  
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;  
            return oWindow;  
        }         
          
        function ConfigureDialog()  
        {  
            //Get a reference to the radWindow wrapper  
            var oWindow = GetRadWindow();  
            var oArg = oWindow.Argument;  
            var oArea = document.getElementById("test");  
            oArea.value = oArg.TextValue;  
        }  
                      
        function OK_Clicked()  
        {  
            var oWindow = GetRadWindow();  
            var oNewText = document.getElementById("test").value;  
            alert ("Text to be returned to main page: " + oNewText);  
            oWindow.close(oNewText);  
        }  
          
        function Cancel_Clicked()  
        {  
            var oWindow = GetRadWindow();             
            oWindow.close();  
        }                 
    </script>     
    <div> 
        <asp:TextBox ID="test" runat="server">12345</asp:TextBox> 
        <button onclick="OK_Clicked(); return false;" class="bButton">OK</button> &nbsp;&nbsp;        
        <button onclick="Cancel_Clicked(); return false;" class="bButton">Cancel</button>     
    </div> 
    </form> 
</body> 


Parent:

 
    <script type="text/javascript">  
    function openSerial()  
    {  
        var oWindow = window.radopen(null, "Side_Serial");  
        oWindow.setSize(500,340);  
    }  
    function OnClientshow(radWindow)  
    {                     
        var oText = document.getElementById("tbSideASerial").value;  
        var arg = new Object();                   
        arg.TextValue = oText;  
        radWindow.Argument = arg;  
    }  
    function CallBackFunction(radWindow, returnValue)  
    {  
        var oArea = document.getElementById("tbSideASerial");  
        if (returnValue) oArea.value = returnValue;  
        else alert ("No text was returned");  
    }  
    </script> 
    <radW:RadWindowManager ID="RadWindowManager1" runat="server">  
        <Windows> 
            <radW:RadWindow ID="Side_Serial"   
                    NavigateUrl="equip_Omega_Serial.aspx" 
                    VisibleOnPageLoad="false"   
                    VisibleStatusbar="true"   
                    VisibleTitlebar="true" 
                    ReloadOnShow = "true" 
                    ClientCallBackFunction="CallBackFunction" 
                    OnClientshow = "OnClientshow" 
                    OffsetElementId = "tbTest"    
                    Skin="Default" /> 
        </Windows> 
    </radW:RadWindowManager> 
0
Georgi Tunev
Telerik team
answered on 15 May 2008, 03:15 PM
Hello Darryl,

Please send me your project so I can check it.


Kind regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Darryl Barney
Top achievements
Rank 1
answered on 18 May 2008, 01:23 AM
I created a new project (my current project is rather large), with just the few files that you will need to see the exact error I receive. How do I attach it?
0
GT
Top achievements
Rank 1
answered on 18 May 2008, 11:34 AM
You must open a support ticket from your client net account - telerik does not allow attachments in the forum.



0
Darryl Barney
Top achievements
Rank 1
answered on 18 May 2008, 10:11 PM
Crud... Well, I will not be able to do this, as I cannot renew my subscription until next quarter. Im actually working on a job, which is going to be paying for the subscription...

I did upload the file to http://www.jocksquarters.com/temp/Test.zip which is a full project showing the problem I am having.
0
Georgi Tunev
Telerik team
answered on 19 May 2008, 12:21 PM
Hello Darryl,

Thank you for the project - I see what the problem is. Since you started this thread in the RadWindow for ASP.NET AJAX forum, I assumed that you are using the RadControls for ASP.NET AJAX suite and gave you solutions for this version of RadWindow.
I can see now however that you are using the old version of RadWindow for ASP.NET. The errors that you receive are because you are using the new client-side API with the "classic" version of the control. To avoid them I would suggest either to upgrade to RadWindow for ASP.NET AJAX or to use the old client-side API as shown in the following documentation article:  http://www.telerik.com/help/aspnet/window/usingradwindowasdialog.html
and in the Returning Values from Dialog demo.


Kind regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Darryl Barney
Top achievements
Rank 1
answered on 19 May 2008, 11:35 PM
Ohh crud... didnt see that the two were split up... Well, I will have to be careful of that :)
Tags
Window
Asked by
Darryl Barney
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Darryl Barney
Top achievements
Rank 1
GT
Top achievements
Rank 1
Share this question
or