radwindow in radajaxpanel direct closes

4 posts, 1 answers
  1. Fit2Page
    Fit2Page avatar
    345 posts
    Member since:
    Feb 2007

    Posted 13 Aug 2014 Link to this post

    i am opening a radwindow frim within a radajaxpanel.
    The moment the window opens it directly is closed automatically again.

    As seen here: http://hama.ontwikkelruimte.nl

    Put something in the shopcart and go to Warenkorb, try to login, there is the problem.

    Any clue?

    Marc
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 14 Aug 2014 in reply to Fit2Page Link to this post

    Hi,

    Please have a look into the sample code snippet which works fine at my end. Try to replicate the issue in the provided code or please provide  a sample code for further help.

    ASPX:
    <telerik:RadAjaxPanel ID="rajxpnlWindow" runat="server">
        <telerik:RadButton ID="rbtnOpenWin" runat="server" Text="OpenWindow">
        </telerik:RadButton>
        <telerik:RadWindow ID="rwindowDemo" runat="server" OpenerElementID="rbtnOpenWin">
            <ContentTemplate>
                <telerik:RadTextBox ID="rtxtUserName" runat="server">
                </telerik:RadTextBox>
                <telerik:RadButton ID="rbtnLogin" runat="server" Text="Login">
                </telerik:RadButton>
            </ContentTemplate>
        </telerik:RadWindow>
    </telerik:RadAjaxPanel>

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Fit2Page
    Fit2Page avatar
    345 posts
    Member since:
    Feb 2007

    Posted 14 Aug 2014 in reply to Shinu Link to this post

    Hey Shinu,

    I created testpage on http://hama.ontwikkelruimte.nl/test.aspx

    with following code:

        <telerik:RadAjaxPanel ID="rajxpnlWindow" runat="server">
        <telerik:RadButton ID="rbtnOpenWin" runat="server" Text="This is a RadButton">
        </telerik:RadButton>
        <telerik:RadWindow ID="rwindowDemo" runat="server">
            <ContentTemplate>
                <telerik:RadTextBox ID="rtxtUserName" runat="server">
                </telerik:RadTextBox>
                <telerik:RadButton ID="rbtnLogin" runat="server" Text="Login">
                </telerik:RadButton>
            </ContentTemplate>
        </telerik:RadWindow>
    </telerik:RadAjaxPanel>
     
     
     
     
      <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
        <asp:Button ID="Button1" runat="server" Text="This is a ASP.NET button" />
             <telerik:RadWindow ID="RadWindow1" runat="server">
            <ContentTemplate>
                <telerik:RadTextBox ID="RadTextBox1" runat="server">
                </telerik:RadTextBox>
                <telerik:RadButton ID="RadButton1" runat="server" Text="Login">
                </telerik:RadButton>
            </ContentTemplate>
        </telerik:RadWindow>
            </telerik:RadAjaxPanel>
    Please bear in mind that the OpenerElements must be ClientIDs so set from CodeBehind

    rwindowDemo.OpenerElementID = rbtnOpenWin.ClientID
           RadWindow1.OpenerElementID = Button1.ClientID

    I hope you can see the difference between the version opened with the RadButton and the native ASP Button.

    Please get back to me...

    Marc

  5. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 14 Aug 2014 Link to this post

    Hi  Marc,

    The button that opens the RadWIndow is configured to do a postback when it is clicked and you need to prevent that. RadWindow's popup element is generated with JavaScript when it needs to be opened, so the postback from the button disposes it and thus - it hides.

    Generally, using the OpenerElementID property should prevent the postback because it cancels the click event. In this case, the RadAjaxPanel captures the button click in order to make the partial postback, so a postback still occurs. To avoid that, you can add a simple script to do the job, for example:

    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
    <telerik:RadCodeBlock runat="server" ID="RadCodeBlock1">
        <script type="text/ecmascript">
            function openRw() {
                $find("<%=RadWindow1.ClientID%>").show();
            }
        </script>
    </telerik:RadCodeBlock>
        <asp:Button ID="Button1" OnClientClick="openRw(); return false;" runat="server" Text="This is a ASP.NET button" />
        <telerik:RadWindow ID="RadWindow1" runat="server">
            <ContentTemplate>
                <telerik:RadTextBox ID="RadTextBox1" runat="server">
                </telerik:RadTextBox>
                <telerik:RadButton ID="RadButton1" runat="server" Text="Login">
                </telerik:RadButton>
            </ContentTemplate>
        </telerik:RadWindow>
    </telerik:RadAjaxPanel>

    On a side note, I also advise that you examine this article to see how to use the RadWIndow's ContentTemplate with AJAX: http://www.telerik.com/help/aspnet-ajax/window-ajaxifying.html. It seems to me that you need the RadAjaxPanel in the RadWindow's ContentTemplate, not around the entire control and the button. Moving it there will let you again use the OpenerElementID property because the opener button will not be ajax-enabled.

     

    Regards, Marin Bratanov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top