This is a migrated thread and some comments may be shown as answers.

radwindow in radajaxpanel direct closes

3 Answers 27 Views
Window
This is a migrated thread and some comments may be shown as answers.
Fit2Page
Top achievements
Rank 1
Iron
Veteran
Iron
Fit2Page asked on 13 Aug 2014, 01:34 PM
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

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 14 Aug 2014, 06:42 AM
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.
0
Fit2Page
Top achievements
Rank 1
Iron
Veteran
Iron
answered on 14 Aug 2014, 08:15 AM
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

0
Accepted
Marin Bratanov
Telerik team
answered on 14 Aug 2014, 08:45 AM

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.

 
Tags
Window
Asked by
Fit2Page
Top achievements
Rank 1
Iron
Veteran
Iron
Answers by
Shinu
Top achievements
Rank 1
Fit2Page
Top achievements
Rank 1
Iron
Veteran
Iron
Marin Bratanov
Telerik team
Share this question
or