Close RadWindow - Behaviors="Close"

4 posts, 0 answers
  1. Daniela
    Daniela avatar
    12 posts
    Member since:
    Aug 2010

    Posted 28 Dec 2010 Link to this post

    We have a problem with the close of the RadWindow about Telerik-function (Behaviors="Close").

    We use a RadWindow with the Attribute "Behaviors=Close"

    <telerik:RadWindow ID="RadWindowProgramCategory" EnableShadow="true" Behaviors="Close" runat="server">
    ......
      <asp:Button ID="ButtonCloseWindow"  runat="server" Text="Close" OnClick="OnCloseWindow" />
    .....
    </telerik:RadWindow>

    The RadWindow open with the button "ButtonOpenRadWindow".

    <asp:Button ID="ButtonOpenRadWindow" Text="Hinzufügen" ToolTip="Hinzufügen" runat="server" OnClick="OnOpenRadWindow"></asp:Button>
      
        protected void OnOpenRadWindow(object sender, EventArgs args)
        {
          AllVirtualCategories.SelectedIndex = -1;
          UpdateCatagoryFields();
      
          RadWindowProgramCategory.Title = App_LocalResources.CategoryDataControl_ascx.RadWindow_TitleAddCategory;
          RadWindowProgramCategory.VisibleOnPageLoad = true;
          RadWindowProgramCategory.Enabled = true;
          RadWindowProgramCategory.Modal = true;
          RadWindowProgramCategory.AutoSize = true;
      
          String radWindowScript = JavaScript.GetJsOpenWindowIncCloseWindow(RadWindowProgramCategory, "");
          ScriptManager.RegisterStartupScript(RadWindowProgramCategory, this.GetType(), "RadWindowProgramCategory", radWindowScript, true);
        }

    Thge Radwindow must open after the Postback. That works with
    RadWindowProgramCategory.VisibleOnPageLoad = false;

    We can close the Window about a another button and a server-side function.
    protected void OnCloseWindow(object sender, EventArgs args)
    {
      RadWindowProgramCategory.VisibleOnPageLoad = false;
      RadWindowProgramCategory.Enabled = false;
    }

    When we close the RadWindow about icon on RadWindow Behaviors="Close" an we again a postback then opens the window again.

    how can we change this?

    Best regards
    Daniela Fischer
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 30 Dec 2010 Link to this post

    Hello Daniela,


    This is expected behaviour since the RadWindow preserves ViewState after postback. In your case, setting EnableViewState property of RadWindow will work for you.

    And also refer the following forum which discusses similar scenario.
    Stop RadWindow from always loading on page postback

    Thanks,
    Princy.
  3. Daniela
    Daniela avatar
    12 posts
    Member since:
    Aug 2010

    Posted 02 Jan 2011 Link to this post

    hello Princy,

    thank you for your feedback.

    this is not the solution to my problem.
    I want the window remains visible in a postback. but only when a postback is triggered within the window. if I close the windows on the icon (see screenshot above) to open any more windows.

    Icon for the RadWindow
    RadWindowProgramCategory.Behaviors = Telerik.Web.UI.WindowBehaviors.Close;

    Its own button I can control when I set the property

         VisibleOnPageLoad = false;

    Behind Telerik generated javascript at "WindowBehaviors.Close" I can not write their own code.

    There is a solution for this?
    I hope I could describe the problem well. if not then I create an example.

    Regards Dani
  4. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 03 Jan 2011 Link to this post

    Hello Daniela,

    I recommend you to wrap the content of the RadWindow in a RadAjaxPanel and set the RadWindow's EnableViewState="false" (as Princy suggested). In this case, any postback initiated inside the content of the RadWindow control will not affect the window itself.

    Greetings,
    Fiko
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top