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

Redirect To Parent Page from RadWindow

5 Answers 278 Views
Window
This is a migrated thread and some comments may be shown as answers.
Amit
Top achievements
Rank 1
Amit asked on 04 Jan 2012, 08:50 AM
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???

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 04 Jan 2012, 10:32 AM
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.
0
Amit
Top achievements
Rank 1
answered on 04 Jan 2012, 11:08 AM
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 ?
0
Svetlina Anati
Telerik team
answered on 04 Jan 2012, 01:25 PM
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
0
Amit
Top achievements
Rank 1
answered on 05 Jan 2012, 05:59 AM
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
0
Accepted
Marin Bratanov
Telerik team
answered on 06 Jan 2012, 12:43 PM
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
Tags
Window
Asked by
Amit
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Amit
Top achievements
Rank 1
Svetlina Anati
Telerik team
Marin Bratanov
Telerik team
Share this question
or