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

Passing a value from one RadWindow to Another

3 Answers 157 Views
Window
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 01 Sep 2012, 09:09 PM
Further to this earlier post of mine, I encountered a new problem whereby I couldn't properly retrieve the value entered in the TextBox in the secondary RadWindow.  Instead of the actual value entered, I was always getting "0" as the Text property.

So I read everything I could find including this and this but none of these solutions seemed to work.

I eventually resorted to using the TextBox's onblur event to store the final value entered into a HiddenField control on the page.  I could then retrieve this value successfully from my server-side code.

But I'm wondering, is that the only (easiest?) way to pass back such a value from a secondary RadWindow?

Note: All of my RadWindows have Ajax UpdatePanels on them.

Robert

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 03 Sep 2012, 04:34 AM
Hi Robert,

You can pass a value from one RadWindow to another Radwindow as follows.

Second RadWindow

Javascript:
function returnValue()
 {
   var txt = $find("<%= RadTextBox1.ClientID %>");
   var value = txt._value;
 
   //Get a reference to the parent page
   var oWnd = GetRadWindow();
 
   //get a reference to the second RadWindow
   var dialog1 = oWnd.get_windowManager().getWindowByName("RadWindow1");
 
  // Get a reference to the first RadWindow's content
  var contentWin = dialog1.get_contentFrame().contentWindow
                 
  //Call the predefined function in Dialog1
  contentWin.populate(value);
 
  oWnd.close();
 }

First RadWindow

Javascript:
function populate(arg)
{
  var value = arg ; // Getting the value From Second RadWindow
  // Your Code
}

Thanks,
Shinu.
0
Robert
Top achievements
Rank 1
answered on 13 Sep 2012, 11:38 PM
Shinu,

Thank you for your response and my apology for not replying earlier.

As I alluded to in my post, I need the value in my server-side code.  Your solution is strictly on the client.

So once again I must ask: When a RadWindow is the container, is there a better/easier solution to get the entered value in a TextBox back to the server-side code than storing it in a HiddenField control?

Robert
0
Accepted
rdmptn
Top achievements
Rank 1
answered on 14 Sep 2012, 11:37 AM
Cross-frame communication can only happen on the client, via JavaScript. This means that when you get the value on the client-side in the desired frame you should consider your options on sending it to the server - a hidden field is a good way, you can change the window.location.href to append a querystring, perform an AJAX request and add it as a parameter,...In all cases you have to add code to initiate the postback and transfer the data to your server code.
Tags
Window
Asked by
Robert
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Robert
Top achievements
Rank 1
rdmptn
Top achievements
Rank 1
Share this question
or