Cannot update control inside RadWindow

5 posts, 0 answers
  1. Jerry
    Jerry avatar
    3 posts
    Member since:
    Feb 2008

    Posted 17 Feb 2011 Link to this post


    I've been testing this for hours now.

    If I add a RadWindowManager with one RadWindow and a Label in it and set it to VisibleOnPageLoad="true".

    And a button which changes the Label's text to Label1.Text = "Hello World".
    The button is inside a RadAjaxPanel.

    I can't get the label to update the value inside the RadWindow.

    No matter what I do. Can you give me a simple example on how to make the window update the label when I've pressed the button.

    Regards, Jerry
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 18 Feb 2011 Link to this post

    Hello Jerry,

    Here is a sample code to achieve the same.
    <telerik:RadAjaxPanel ID="Panel1" runat="server">
         <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button2_Click" />
      <telerik:RadWindowManager ID="RadWindowManager1" VisibleOnPageLoad="true" VisibleStatusbar="false"
                ReloadOnShow="true" runat="server" Skin="Sunset" EnableShadow="true">
              <telerik:RadWindow ID="RadWindow1" runat="server" Behaviors="Close">
                   <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>   

    protected void Button2_Click(object sender, EventArgs e)
       Label mybox = RadWindow1.ContentContainer.FindControl("Label1") as Label;
       mybox.Text = "Hello";

  3. Roger
    Roger avatar
    5 posts
    Member since:
    Aug 2007

    Posted 16 Nov 2011 Link to this post

    Is there a way to achieve this client side?

  4. Marin Bratanov
    Marin Bratanov avatar
    5922 posts

    Posted 17 Nov 2011 Link to this post

    Hello Roger,

    Please examine the following online demo: It shows the way to access controls in the ContentTemplate of the RadWindow via JavaScript. Basically you need their ClientID as the RadWindow is an INaming container in this case. This is a general case and you would have the same behavior with other container controls (master pages, update panels, etc).

    Best wishes,
    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. Dhamodharan
    Dhamodharan avatar
    300 posts
    Member since:
    Sep 2010

    Posted 18 Nov 2011 Link to this post


    Hope this will help,

     function Button2_Click(sender, args) {
              document.getElementById('RadWindow1_C_Label1').innerHTML = "test";
              return false;

Back to Top