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

Passing argument client side to RadWindow and catching server side

1 Answer 179 Views
Window
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 02 Oct 2012, 05:54 PM
I'm currently working on using RadWindows for the first time.
I've been able to figure that using the "ClientShow" I can pass an argument to the RadWindow and catch it in the window on the client side, However I need this on the server side once I get here.

Here's what I'm using on the client side for the parent page:
function clientShow(sender, eventArgs) {
         var tree = $find("<%= tvwBidPackageFolders.ClientID %>");
         var node = tree.get_selectedNode();
           
           if (node) {
               var attributes = node.get_attributes();
               var attribute1 = attributes.getAttribute("fid");
               sender.argument = attribute1;
                          }    
        }

I'm able to run this client code on the RadWindow and get the argument:
function pageLoad() {
           txtInput = $get('txtUserInput');
           var currentWindow = GetRadWindow();
           txtInput.value = currentWindow.argument;
       }

Now on the server, I've tried Load, PreRender, etc. hoping that the txtInput will be filled and it's always blank.
How can I get the currentWindow.argument value in the server side?

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 04 Oct 2012, 07:36 AM
Hello Jay,

The pageLoad() shortcut actually points to the Sys.Application.Load event of the page. This is a client-side event that fires once all control instances have been instantiated. This means that the server events of the page have passed already and the page has been sent to the client.

If you need this value on the server I can suggest two ways to achieve it:
1) use a querystring in the URL that you open inside the RadWIndow, as shown in this demo: http://demos.telerik.com/aspnet-ajax/window/examples/usingurlforserverarguments/defaultcs.aspx.
2) initiate a postback with your JavaScript code that will post the value to the server so you can use it. You can either use the __doPostBack() function or the RadAjaxManager's client-side API to initiate an AJAX request. Both cases will post the content page again, while the first approach will not require a second postback.


All the best,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Window
Asked by
Jay
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or