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

Wnd is null when calling show()

2 Answers 22 Views
Window
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 19 Jul 2013, 01:18 AM
I'm trying to show a simple modal notification on page load but I get an error when I call show() on the window. can someone tell me what I'm missing?

TypeError: wnd is null
wnd.show();

Thanks

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
 
<telerik:RadWindow ID="Window1" runat="server" Width="360px" Height="260px">
    <ContentTemplate>
        <p>Thank you for requesting a free issue.</p>
    </ContentTemplate>
</telerik:RadWindow>
 
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        var key = "magazine"
 
        var regex = new RegExp("[\\?&]" + key + "=([^&#]*)");
        var qs = regex.exec(window.location.href);
   
        if(qs != null) {
            if (qs[1] == "confirmed") {
                ShowMagazineSubscriptionConfirmed();
            }
        }
 
        function ShowMagazineSubscriptionConfirmed() {
            var wnd = $find("<%=Window1.ClientID %>");
            wnd.show();
        }
    </script>
</telerik:RadCodeBlock>

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 19 Jul 2013, 06:25 AM
Hi Jeff,

I have tried your code but the I am always getting a null value for the variable qs. Since you want the RadWindow to be displayed on page load you can write the corresponding code in the client side pageLoad event. Please have a look into the sample code I tried with sample values which works fine as expected.

JavaScript:
<telerik:RadWindow ID="Window1" runat="server" Width="360px" Height="260px">
    <ContentTemplate>
        <p>
            Thank you for requesting a free issue.</p>
    </ContentTemplate>
</telerik:RadWindow>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function pageLoad() {
            var status = new Array("not confirmed", "confirmed");
            if (status != null) {
                if (status[1] == "confirmed") {
                    showmagazinesubscriptionconfirmed();
                }
            }
        }
        function showmagazinesubscriptionconfirmed() {
            var radwindow = $find("<%=Window1.ClientID %>");
            radwindow.show();
        }
    </script>
</telerik:RadCodeBlock>

Thanks,
Shinu.
0
Jeff
Top achievements
Rank 1
answered on 19 Jul 2013, 03:59 PM
Thanks for your help.
Tags
Window
Asked by
Jeff
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Jeff
Top achievements
Rank 1
Share this question
or