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

OpenRadWindow and load it's content

5 Answers 71 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Lorenzo
Top achievements
Rank 1
Lorenzo asked on 12 Nov 2010, 06:03 PM
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

5 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 15 Nov 2010, 10:58 AM
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
0
Lorenzo
Top achievements
Rank 1
answered on 16 Nov 2010, 03:34 PM
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


0
Lorenzo
Top achievements
Rank 1
answered on 18 Nov 2010, 10:20 AM
Any ideas ..... ???

Plz !

Lorenzo
0
Accepted
Maria Ilieva
Telerik team
answered on 18 Nov 2010, 04:37 PM
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.
0
Lorenzo
Top achievements
Rank 1
answered on 19 Nov 2010, 09:58 AM
Seems to work great !

Thanks.

Lorenzo
Tags
Ajax
Asked by
Lorenzo
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Lorenzo
Top achievements
Rank 1
Share this question
or