Domanda

Greetings to you dear colleagues!

Prompt.

I have here a situation - there is a component RadWindows RadButton button on it by pressing a button in the RadGrid RadWindows component is set to Visible = true; But after PostBack and shape RadWindows disappears. But going into the RadWindows everything remains as it was changed to reboot.

Question: How to prevent reload the page.

Who does not know what are the components of Rad Teleric.

The source code can throw if it helps.

Thank you, Regards!

È stato utile?

Soluzione

Set DestroyOnClose="true" to prevent the window from reopening after close or postback. It sounds like you may be setting the Visible property to true using server-side code. This is bad practice which leads to issues like you describe. RadWindows should be opened via the client-side methods.

On the server side use this code to open a window from the client side using the RadWindow.Show client-side method while having DestoryOnClose set to true. You can customize the script string should you want to use the RadWindow.Open() method to pass a url to the window.

    private void ShowWindow()
    {
        string script = "function f(){$find(\"" + YourRadWindow.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
    }

Altri suggerimenti

Consider opening it with JavaScript, this will let you stop using these unnecessary postbacks: http://www.telerik.com/help/aspnet-ajax/window-programming-opening.html. Use OnClientClicking of the RadButton: http://blogs.telerik.com/aspnet-ajax/posts/12-08-10/migrating-onclientclick-handlers-from-asp-button-to-telerik-s-asp-net-ajax-button.aspx.

You can also use AJAX to prevent full postbacks that will dispose (and thus, hide) the RadWindow: http://www.telerik.com/help/aspnet-ajax/radwindow-ajaxifying.html.

Read this sticky to see how to open it from the server if you need to. If you set VisibleOnPageLoad to true it will re-show after postbacks, so you will only need to take care of setting the property back to false when you need to: http://www.telerik.com/community/forums/aspnet-ajax/window/opening-radwindow-from-the-server.aspx.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top