Redirect To Parent Page from RadWindow

6 posts, 1 answers
  1. Amit
    Amit avatar
    14 posts
    Member since:
    Sep 2012

    Posted 04 Jan 2012 Link to this post

    Hi,
    i am using RadWindow in my Portal and i have few text box on my Radwindow and one Image Button..... i want to know that how to Close my Radwindow and Redirect page to parent page when i click on Image button which is on Radwindow ..can any one help me???
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 04 Jan 2012 Link to this post

    Hello,

    Try the following.
    ASPX:
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
      <Windows>
        <telerik:RadWindow ID="RadWindow1" runat="server">
           <ContentTemplate>
              <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/img.gif" OnClick="ImageButton1_Click"/>
            </ContentTemplate>
         </telerik:RadWindow>
      </Windows>
    </telerik:RadWindowManager>
    <asp:Button ID="btn" runat="server" Text="open" OnClientClick="OnClientClick(); return false;" />
    JS:
    <script type="text/javascript">
    function OnClientClick()
      {
         var win = window.radopen(null, "RadWindow1");
      }
    </script>
    C#:
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
       {
           Response.Redirect("ParentPage.aspx");
       }

    -Shinu.
  3. Amit
    Amit avatar
    14 posts
    Member since:
    Sep 2012

    Posted 04 Jan 2012 Link to this post

    Thank you so much Shinu for your reply but i forgot to mention in my question that i am using ASCX (User Control) page as my parent page and i want to redirect on ASCX page from code behind with parameter value... can this possible ?
  4. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 04 Jan 2012 Link to this post

    Hello Amit,

    In case you have used the approach with a ContentTemplate as Shinu has used and your user control is inside that template you can use the very same code. As to adding the parameter, you can pass it as a query string value in a similar manner to that:

     

    Response.Redirect("ParentPage.aspx?myParam=customParam");


    In case you are using a NavigateUrl and you have a separate page, you should execute a script from the server to change the top of the frame tree or you should use frame buster script code in the page you redirect to. A frame buster script which will work is the following one:

    if (window != window.top) window.top.location.href = window.location.href;

    In case you need further assistance, please provide more details of your setup and best - a simple reproduction demo (no need for complex custom logic, only the RadWindow setup/configuration.main/content page and a button) along with detailed explanations and we will help you achieve what you need.

     

    Greetings,
    Svetlina Anati
    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
  5. Amit
    Amit avatar
    14 posts
    Member since:
    Sep 2012

    Posted 04 Jan 2012 Link to this post

    Hello Svetlina,
    Thanks for your Reply

    i m using Ascx page as my master page Design and Coding
    Design
    <telerik:RadWindow ID="RadWindow1" runat="server" AutoSize="True" Animation="Resize" AnimationDuration="100">
    </telerik:RadWindow>

    Code
                    If Not IsPostBack Then               
                          RadWindow1.VisibleOnPageLoad =
    True
                    RadWindow1.Visible = True
                    RadWindow1.Enabled = True
                    RadWindow1.EnableShadow = True
                    RadWindow1.NavigateUrl = "StartTest.aspx?value=" & UserName & "-" & TopicID & "-" & CatID & "-" & EmployeeID & "-" & TestID
                    RadWindow1.VisibleTitlebar = False
                    RadWindow1.ReloadOnShow = False
                    RadWindow1.DestroyOnClose = True
                    'RadWindow1.Behaviors = WindowBehaviors.Pin
                End If
    and i call Radwindow on page_Load Event.. My Button is on ASPX page so what i need to do is when i Press button in my ASPX page.... the Radwindow should close and my ASCX page should load again here is my coding for ASPX Page and one more functionality i want to add is when my Radwindow is opened on the parent page should be freeze or i can say user cannot click on scroll parent page
  6. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    4526 posts

    Posted 06 Jan 2012 Link to this post

    Hello Amit,

    Generally ASCX files are not served, as they are user controls and can exist only as a part of an aspx page. This means that you cannot redirect directly to a user control, but to a page that contains it. How to do this was explained in the previous reply.

    As for blocking the page behind the RadWindow - you can simply use its Modal property and set it to true.

    I can also suggest that you examine this thread on opening the RadWindow from the server.


    All the best,
    Marin
    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
Back to Top