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

Page.Redirect from RadWindow + RadAjaxPanel

1 Answer 111 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Gregory
Top achievements
Rank 1
Gregory asked on 13 Jun 2012, 03:18 PM
Hello. I present a simplified version of the implementation in which I found this problem.

Let's suppose I have a user control, called Redirector, which only has a link button for markup, and who's job it is to redirect to a certain page:
Public Class Redirector
Inherits UserControl
Private Sub lnkRedirect_Command(sender As Object, e As System.Web.UI.WebControls.CommandEventArgs) Handles lnkRedirect.Command
Response.Redirect("~/WebForm2.aspx")
End Sub
End Class

I want to put this on a page, inside of a RadWindow, along with some other controls. Here's the markup for my page:

<%@ Register TagPrefix="testApp" TagName="Redirector" Src="~/Redirector.ascx" %>
 
<asp:Content runat="server" ContentPlaceHolderID="ContentPlaceHolder1" >
 
    Page 1
    <br />
    <asp:Button ID="btnOpen" runat="server" Text="Open" />
 
 
    <trk:RadWindow runat="server" ID="MainRadWindow">
        <ContentTemplate>
     
            Hello there.
 
            <trk:RadAjaxPanel ID="InnerAjaxPanel" runat="server">
 
                <ul>
                    <li>
                        <testApp:Redirector ID="Redirector1" runat="server" />
                    </li>
                    <li>
                        <asp:Button ID="btnPostBack" runat="server" Text="Postback" />
                    </li>
                    <li>
                        <asp:Label ID="lblTime" runat="server" />
                    </li>
                </ul>
 
            </trk:RadAjaxPanel>
 
        </ContentTemplate>
    </trk:RadWindow>
        
 
</asp:Content>

And here is the code-behind for the page:

Public Class WebForm1
    Inherits System.Web.UI.Page
 
    Private Sub btnOpen_Command(sender As Object, e As System.Web.UI.WebControls.CommandEventArgs) Handles btnOpen.Command
        MainRadWindow.VisibleOnPageLoad = True
    End Sub
 
    Private Sub btnPostBack_Command(sender As Object, e As System.Web.UI.WebControls.CommandEventArgs) Handles btnPostBack.Command
        lblTime.Text = Now.TimeOfDay().ToString
    End Sub
End Class

If the user opens the RadWindow and immediately clicks the linkbutton, Page.Redirect() happens with no problem. However, if the user first clicks on btnPostback, and then clicks the linkbutton, the InnerAjaxPanel throws a javascript error.

    Microsoft JScript runtime error: Unable to get value of the property '_events': object is null or undefined

Could you please look into this and let me know what is causing the problem, and how I could fix it?

Thank you.

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 18 Jun 2012, 01:16 PM
Hello Gregory,

Could you please try to redirect the page using the RadAjaxPanel.Redirect() method and verify if this makes any difference?

Kind regards,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Ajax
Asked by
Gregory
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or