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

Where to define RadWindow in ascx or aspx or both?

1 Answer 150 Views
Window
This is a migrated thread and some comments may be shown as answers.
Roger
Top achievements
Rank 1
Roger asked on 12 Dec 2012, 05:36 PM
Hi

I am trying to implement within an Image Viewing application, a Radwindow which opens on the click of a button.

The main window is a div which contains two other divs - a left "sidebar" and a right "viewer"
<div id="container">
        <asp:Panel ID="sidebar" runat="server">
           <asp:PlaceHolder ID="phSideBar" runat="server"></asp:PlaceHolder>
        </asp:Panel>
        <asp:Panel ID="viewer" runat="server">
            <asp:PlaceHolder ID="phViewer" runat="server"></asp:PlaceHolder>
        </asp:Panel>
    </div>

The sidebar contains navigation buttons and links and the viewer panel contains a java applet which handles the image viewing.

During page load, the user controls are added to the placeholders.
protected void Page_Load(object sender, EventArgs e)
{     
        System.Web.UI.Control contSideBar = (System.Web.UI.Control)LoadControl("vwDisplayTest.ascx");
        phSideBar.Controls.Add(contSideBar);      // Add Navigation Control to side bar

       
System.Web.UI.Control contHardCopyOrdering = (System.Web.UI.Control)LoadControl("vwHardCopy.ascx");
        phSideBar.Controls.Add(contHardCopyOrdering);      // Add Order button Control to SideBar  phSideBar
        }

In order for this to work, it appears I need to declare the RadWindow in BOTH the main aspx page AND the ascx page.

Is this correct?  I have searched various topics, but perhaps I have missed something.

Regards
Roger

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 13 Dec 2012, 02:11 PM
Hi Roger,

Where you will declare the RadWindow greatly depends on how you are going to use it. If you are going to load an external page that will show the image you can simply add a RadWIndowManager to the main page and open a popup by simply calling radopen(). The following help article shows the different ways to open a RadWindow so you can choose the one most fitting for your scenario: http://www.telerik.com/help/aspnet-ajax/window-programming-opening.html. In case you are using its COntentTemplate I suggest you start by examining this demo: http://demos.telerik.com/aspnet-ajax/window/examples/contenttemplatevsnavigateurl/defaultcs.aspx. It shows the differences between the modes. In case you need server-side interaction with the content this would be your approach of choice, so you would need the RadWindow in the same INaming container - i.e. in the user control. You would then need to open it by using $find().show() so the JavaScript function should also be in the user control in order for it to use server code blocks to get the ClientID of the control.


Greetings,
Marin Bratanov
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
Roger
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or