Dynamically adding controls to RadWindow ContentContainer

2 posts, 0 answers
  1. Brent
    Brent avatar
    2 posts
    Member since:
    Jul 2016

    Posted 17 Nov 2017 Link to this post


    We use an incredibly old version of your ASP.NET Controls for AJAX: 2013.2.717.40 (we took over this website and it is huge and we haven't wanted to upgrade your controls because of the testing effort involved).

    A previous developer is displaying (and hiding) a RadWindow during postbacks, with VisibleOnPageLoad = true (and false to hide it). I know, that should NOT be done.

    To make this even worse, he had it wrapped in a RadWindowManager and the ascx control where the RadWindow is located, is wrapped in other controls that are all wrapped in RadAjaxPanels (or ajaxed in code-behind). I've removed the RadWindowManager...

    I can NOT remove the RadAjax from this scenario, because of how complicated it is.

    MY ISSUE: The RadWindow is being used as a Content Container, but none of the controls (asp linkbuttons) are displayed when the radwindow is displayed.

    I know the reason for that, based on Telerik documentation I've read. Basically, in the scenario I've given, a separate html block is created for the RadWindow and there are no controls in that one. The other html block is also in the html source of the page and that one does have the buttons in it, but that isn't the one that is being used.

    MY QUESTION: I've tried to add the linkbutton controls to the RadWindow ContentContainer in code, but they still don't show up in the RadWindow when it is displayed. Is that again because of how the developer is doing this, with VisibleOnPageLoad and the fact that it is wrapped in an ajax panel?  Or should the controls have been added and displayed? The only place they were added, was in the html markup that is inside the ajax panel (the radwindow that doesn't get displayed) My code was this:

        protected void Page_Init(object sender, System.EventArgs e)
            var btn1 = new LinkButton();
            var lbl = new Label();
            lbl.Text = "label added";
            btn1.Text = "button added";
            btn1.PostBackUrl = _viewCartUrl;

    The next thing I will try is to show the button with client-side script as you've documented in other examples, like this code that I'll run from a server side button click:

            string script = "function f(){$find(\"" + PopupWindow.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
            System.Web.UI.ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);

    Again though, my main question for now is:  Should the controls that I add dynamically to a RadWindow, display when that RadWindow is shown by using the VisibleOnPageLoad property, when that radwindow is in a control that is wrapped in RadAjax?


  2. Brent
    Brent avatar
    2 posts
    Member since:
    Jul 2016

    Posted 17 Nov 2017 in reply to Brent Link to this post

    Update: Showing the RadWindow by registering javascript on a server button click didn't work either.

    As with all other cases, the RadWindow that has no controls in it is displayed (the second one that is created in the dom, outside of the radajax panel).

    As a last resort, I'll make this a RadWindow with no content and use the NavigateUrl to point to an ascx that has the content, but please respond to my original post if you have any suggestions or comments.

Back to Top