Вопрос

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 uses a RadAjaxManagerProxy and has a control that 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 = true in some 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 which we used to call the server-side OnAjaxRequest event of the RadAjaxManager. This fires a server side event and I can set the property, like so:

JS:

function WindowClose(sender, args) {
    SendRequest("ArgumentName");
}

function SendRequest(requestName) {
    var ajaxManager = $find("<%= RadAjaxManagerMain.ClientID %>");

    ajaxManager.ajaxRequest(requestName);
}

C#:

protected void RadAjaxManagerMain_AjaxRequest(object sender, AjaxRequestEventArgs args)
{
    if (args.Argument == "ArgumentName")
    {
        RadWindow1.VisibleOnPageLoad = false;
    }
}

But since I'm using a RadAjaxManagerProxy, the OnAjaxRequest method of the RadAjaxManager isn't supported.

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. I already have a Javascript method that's fired when I close the window, I just can't figure out a way to get the window to stay closed without doing a full postback.

How can I prevent my RadWindow from opening on another AJAX request?

Это было полезно?

Решение

Just found the solution. It was right in front of my face. Setting EnableViewState="false" on the RadWindowManager prevented this issue from happening. So simple. Hope it helps someone in the future.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top