OnAjaxRequest for RadAjaxManagerProxy

2 posts, 0 answers
  1. Derek
    Derek avatar
    19 posts
    Member since:
    Jun 2011

    Posted 11 Apr 2013 Link to this post

    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.
  2. Marin Bratanov
    Marin Bratanov avatar
    5470 posts

    Posted 15 Apr 2013 Link to this post

    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.

    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.
Back to Top