Dynamically create a radwindow

3 posts, 1 answers
  1. Henry
    Henry avatar
    44 posts
    Member since:
    Feb 2013

    Posted 07 Mar 2013 Link to this post

    Hi folks,

    I want to dynamically create a RadWindow and add it to the web form. can anyone help with a sample code?

  2. Answer
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 07 Mar 2013 Link to this post

    Hello Henry,

    Please have a look at the following code to understand how to create a RadWindow dynamically and add it to your web form.

    protected void createDynamicWindow()
        //Create a new window add it dynamically
        //The window will inherit the default settings of parent WindowManager
        Telerik.Web.UI.RadWindow newWindow = new Telerik.Web.UI.RadWindow();
        newWindow.NavigateUrl = "http://www.yoururl.com";
        //Set OpenerElementId - the id (ClientID if a runat=server is used) of a html element, which, when clicked, will automatically open/show the Telerik RadWindow
        newWindow.OpenerElementID = OpenerButton.ClientID;
        //Set OffsetElementID - the id (ClientID if a runat=server is used) of a html element, whose left and top position will be used as 0,0 of the Telerik RadWindow object when it is first shown
        newWindow.OffsetElementID = OpenerButton.ClientID;
        //Top and Left can be used in conjunction with the OffsetElementId (if no OffsetElementId is specified, the top left corner of the browser window is used
        newWindow.Top = Unit.Pixel(22);
        newWindow.Left = Unit.Pixel(0);
        //as a separate control, you can add the newly created RadWindow directly to the form's Controls collection

  3. DevCraft R3 2016 release webinar banner
  4. rdmptn
    rdmptn avatar
    72 posts
    Member since:
    Aug 2011

    Posted 08 Mar 2013 Link to this post

    Or use simple JavaScript on the client with the RadWindowManager. This will spare you a postback and recreating controls: http://www.telerik.com/help/aspnet-ajax/window-programming-opening.html.
Back to Top