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

OnAjaxRequest for RadAjaxManagerProxy

1 Answer 95 Views
Window
This is a migrated thread and some comments may be shown as answers.
Derek
Top achievements
Rank 1
Derek asked on 11 Apr 2013, 02:45 PM
I have an application using a MasterPage with content pages and user controls. Inside one of the user controls we have another user control (I know, it's an Inception kind of thing). This user control spawns a RadWindow. Everything works fine: the window shows some RadGrids populated with fields from the DB, then I close the window. All of this is being done with RadWindow1.VisibleOnPageLoad in some kind of server-side event. After closing the window, I have no way of setting RadWindow1.VisibleOnPageLoad = false; so when I click on another control that fires an AJAX event (which in this case shows a different RadWindow) the RadWindow from before pops back up. In other parts of our application we've passed arguments to the server through the OnClientClose method of the RadWindow and also by calling the OnAjaxRequest event of the RadAjaxManager. This fires a server side event and I can set the property, but I'm using a RadAjaxManagerProxy, which doesn't support this event. 

I've come up with some options for this:

- Set VisibleOnPageLoad on the client side, which I can't find anywhere on any forums or documentation.
- Pass some kind of different event to the server so I can set the property.

Or maybe there's something completely different that I'm not aware of or haven't thought of. I'm open to any options.

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 15 Apr 2013, 11:47 AM
Hello Derek,

On opening the popup from the server I advise you examine the following sticky thread: http://www.telerik.com/community/forums/aspnet-ajax/window/opening-radwindow-from-the-server.aspx. The script registration or disabling the ViewState should work for your case.

On handling data passed back from the popup - you can generate a request in many ways. Perhaps the most straightforward is having an ASP:UpdatePanel with a hidden button inside (Style="display: none;") so its server handler can provide an easy hook for custom code. Triggering a click from this button can be done with JavaScript - either $get(buttonClientId).click() or __doPostBack(button.name,''). Custom data can be stored in a hidden field right next to the button so you can obtain it on the server if need be. This KB article can also be useful on hooking the OnClientClose handler individually for each user control instance to prevent functions with the same name from overriding each other. There are many other ways to initiate a request to the server that depend on the current case. This blog post can be interesting in this regard.


Greetings,
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
Derek
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or