OpenRadWindow and load it's content

6 posts, 1 answers
  1. Lorenzo
    Lorenzo avatar
    42 posts
    Member since:
    Jul 2009

    Posted 12 Nov 2010 Link to this post

    Hi,
    please bee good with me on this one, I'm sure the solution is stupid, but it is driving me crazy !
    The problem is:
    I have a Page with a RadWindowManager which contains a single RadWindow which contains ContentTemplate with some controls inside. In the same page I have a simple Link that triggers a javascript function that opens the window and triggers an ajaxrequest.

    In the code behind of the page i get the ajaxrequest and I "should" do something on the controls inside the RadWindow.
    The problem is that the RadWindow opens correctly, the ajaxrequest event gets raised correctly, but nothing happens on the controls inside the window !

    Here is the code:
    test.aspx
     
    <%@ Page Title="" Language="VB" MasterPageFile="~/Resources/PAI_MasterPage.master" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %>
     
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder_Body" Runat="Server">
    <script language="javascript">
        function MyOpen() {
            
            var oWM = $find("<%=MyWM.ClientID%>");
            var oWin = oWM.open(null, 'W_PaiToolPackItem');
            var ajaxManager = $find("<%= M.ClientID %>");
            ajaxManager.ajaxRequest("IdCustomer");
        }
    </script>
    <telerik:RadAjaxManager runat="server" ID="M">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="B">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="P" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
     
    <a href="javascript:MyOpen();">Open</a>
     
    <telerik:RadWindowManager runat="server" ID="MyWM" Enabled="True">
    <Windows>
        <telerik:RadWindow runat="server" ID="W_PaiToolPackItem">
            <ContentTemplate>
     
                    <asp:Button runat="server" ID="B" Text="Bottone" />
                 
                    <asp:Panel runat="server" ID="P">
                     
                        <asp:Label runat="server" ID="L"></asp:Label>
                         
                    </asp:Panel>
                     
            </ContentTemplate>
         
        </telerik:RadWindow>
    </Windows>
     
    </telerik:RadWindowManager>
     
    </asp:Content>


    here is the code behind:
    test.aspx.vb
    Partial Class test
        Inherits System.Web.UI.Page
     
     
        Protected Sub M_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles M.AjaxRequest
            L.Text = "Ajax Load"
     
        End Sub
     
    End Class

    The action to perform is stupid, but it does not happen !
    If I click onto the button (and a postback starts) the Label loads !

    Please help

    Thank you

    Lorenzo

  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 15 Nov 2010 Link to this post

    Hi,

    Please add the following Ajax setting in order to have the label load properly on AjaxRequest:

    <telerik:AjaxSetting AjaxControlID="M">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="P" />
               </UpdatedControls>
    </telerik:AjaxSetting>

    I hope this helps.

    Sincerely yours,
    Maria Ilieva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Lorenzo
    Lorenzo avatar
    42 posts
    Member since:
    Jul 2009

    Posted 16 Nov 2010 Link to this post

    Hi,
    your suggestion seems to solve my problem, but now I have a new one !
    In the page I put a label and would like that pressing the button inside the RadWindow a certain text gets loaded into the label.

    I attach code
    <%@ Page Title="" Language="VB" MasterPageFile="~/Resources/PAI_MasterPage.master" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %>
     
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder_Body" Runat="Server">
    <script language="javascript" type="text/javascript">
        function MyOpen() {
            
            var oWM = $find("<%=MyWM.ClientID%>");
            var oWin = oWM.open(null, 'W_PaiToolPackItem');
            var ajaxManager = $find("<%= M.ClientID %>");
            ajaxManager.ajaxRequest("IdCustomer");
        }
    </script>
     
    <telerik:RadAjaxManager runat="server" ID="M">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="M">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="P" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="B">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="LL" />
                    <telerik:AjaxUpdatedControl ControlID="P" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
     
    <a href="javascript:MyOpen();">Open</a>
    <br /><br />
     
    <asp:Label runat="server" ID="LL"></asp:Label>
     
    <telerik:RadWindowManager runat="server" ID="MyWM" Enabled="True">
    <Windows>
        <telerik:RadWindow runat="server" ID="W_PaiToolPackItem">
            <ContentTemplate>
     
                    <asp:Button runat="server" ID="B" Text="Bottone" />
                 
                    <asp:Panel runat="server" ID="P">
                     
                        <asp:Label runat="server" ID="L"></asp:Label>
                         
                    </asp:Panel>
                     
            </ContentTemplate>
         
        </telerik:RadWindow>
    </Windows>
     
    </telerik:RadWindowManager>
     
    </asp:Content>

    While in the code behind I have
    Partial Class test
        Inherits System.Web.UI.Page
     
     
        Protected Sub M_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles M.AjaxRequest
            L.Text = e.Argument
        End Sub
     
        Protected Sub B_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles B.Click
            L.Text = "PostBack"
            LL.Text = "Button clicked"
        End Sub
    End Class

    Now the page throws, while loading the obnoxious error:

    The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). 


    What's wrong !??

    Thanks again

    Lorenzo


  4. Lorenzo
    Lorenzo avatar
    42 posts
    Member since:
    Jul 2009

    Posted 18 Nov 2010 Link to this post

    Any ideas ..... ???

    Plz !

    Lorenzo
  5. Answer
    Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 18 Nov 2010 Link to this post

    Hello Lorenzo,

    I would suggest you to wrap the JS code into RadCodeBlock control. See this article for more information on this.

    Greetings,
    Maria Ilieva
    the Telerik team

    Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  6. Lorenzo
    Lorenzo avatar
    42 posts
    Member since:
    Jul 2009

    Posted 19 Nov 2010 Link to this post

    Seems to work great !

    Thanks.

    Lorenzo
Back to Top