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

RadAjax Manager Proxy control is not giving error on master pages

2 Answers 52 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Deepak
Top achievements
Rank 1
Deepak asked on 27 Jul 2010, 07:11 AM
I am using master page in my asp.net website.
Master page contains the RadAjaxManeger control.

In the child page I am using RadAjaxManagerProxy control to handle ajax post.
I am also using RadWindowManager control in the child page.
When I add this code in my child page.
 <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server"  >
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="tbInvestors">
                 <UpdatedControls>                  
                     <telerik:AjaxUpdatedControl ControlID="tbInvestors" />
                     <telerik:AjaxUpdatedControl ControlID="lblInvestorStatus" />
                     <telerik:AjaxUpdatedControl ControlID="lblInvestorID" />                 
                 </UpdatedControls>
             </telerik:AjaxSetting>       
        </AjaxSettings>        
    </telerik:RadAjaxManagerProxy>

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

and IF I remove it then the pages starts working fine.
Could you please help me here.


here is my master page code
<%@ Master Language="VB" CodeFile="SiteMaster.master.vb" Inherits="SiteMaster" %>

<%@ Register TagPrefix="GD" TagName="Footer" Src="App_controls/Footer.ascx" %>
<%@ Register TagPrefix="GD" TagName="TopMenu" Src="App_controls/App_Controls_TopMenu.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>CEMG Property Management System</title>
    <link href="CSS/CEMG.css" rel="stylesheet" type="text/css" />
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body class="BODY">
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="ScriptManager1" runat="server" EnableTheming="True">
    </telerik:RadScriptManager>
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">
    </telerik:RadStyleSheetManager>
    <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" Skin="Office2007" />
    <asp:Label ID="lblAlert" runat="server"></asp:Label>
    <div>
        <GD:TopMenu ID="TopMenu1" runat="server"></GD:TopMenu>
        <br />
        <asp:ContentPlaceHolder ID="MainContent" runat="server">
            <!-- Page-specific content will go here... -->
        </asp:ContentPlaceHolder>
        <asp:Label ID="lblPropertyID" runat="server" Visible="False"></asp:Label>
    </div>
    <GD:Footer ID="Footer" runat="server"></GD:Footer>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
    </asp:ContentPlaceHolder>
    </form>
</body>
</html>


here is my child page code.
<%@ Page Title="" Language="VB" MasterPageFile="~/SiteMaster.master" AutoEventWireup="false" CodeFile="ManagementDashboard.aspx.vb" Inherits="ManagementDashboard" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
        <Scripts>
            <asp:ScriptReference Path="~/JS/jquery-1.4.2.min.js" />
        </Scripts>
    </asp:ScriptManagerProxy>
    <script type="text/javascript">
        function populateSelectedOwners(sender, args) {
            var textBox;
            textBox = $find("<%= tbOwners.ClientID %>");
            textBox.set_value(args.get_argument());

            return false;
        }
        function populateSelectedInvestors(sender, args) {
            var textBox;
            textBox = $find("<%= tbInvestors.ClientID %>");
            textBox.set_value(args.get_argument());

            return false;
        }
        function populateSelectedPartners(sender, args) {
            var textBox;
            textBox = $find("<%= tbPartners.ClientID %>");
            textBox.set_value(args.get_argument());

            return false;
        }
    </script>
    <table width="100%" border="0" cellspacing="3" style="background-color:#ffffff;" cellpadding="0" >
      <tr>
        <td class="tableBorder" align="center">Custom Filters</td>
      </tr>
      <tr>
        <td align="left" valign="top"><table width="100%" border="0" cellspacing="5" cellpadding="0">
          <tr>
            <td width="150px" nowrap="nowrap" class="SmallTxtBold" valign="middle" >Owner:</td>
            <td align="left" valign="middle" >
                <table border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td valign="middle"><telerik:RadTextBox ID="tbOwners" runat="server"
                                Skin="Office2007" Width="300px" AutoPostBack="True"> </telerik:RadTextBox></td>
                           <td valign="middle"><img id="imgOwners" onclick="window.radopen(null, 'tbOwnersDialog');" src="images/search_icon.gif" align="absbottom" runat="server" /> </td>
                        <td valign="middle" width="300px" nowrap="nowrap"><asp:Label ID="lblOwnerStatus" runat="server"></asp:Label><asp:Label ID="lblOwnerID" runat="server" Visible="false"></asp:Label></td>
              </tr>
            </table>
          </tr>
          <tr>
            <td  nowrap="nowrap" class="SmallTxtBold" valign="middle" >Investor:</td>
            <td align="left" valign="middle"><table border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td valign="middle"><telerik:RadTextBox ID="tbInvestors" runat="server" Skin="Office2007" AutoPostBack="True"
                        Width="300px"> </telerik:RadTextBox></td>
                <td valign="middle"><img id="imgInvestors" onclick="window.radopen(null, 'tbInvestorsDialog');" src="images/search_icon.gif" align="absbottom" runat="server" /> </td>
                <td valign="middle" width="300px" nowrap="nowrap"><asp:Label ID="lblInvestorStatus" runat="server"></asp:Label>
                    <asp:Label ID="lblInvestorID" runat="server" Visible="false"></asp:Label></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td nowrap="nowrap" class="SmallTxtBold" valign="middle" >Partner:</td>
            <td align="left" valign="middle"><table border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td valign="middle"><telerik:RadTextBox ID="tbPartners" runat="server" Skin="Office2007" AutoPostBack="True"
                        Width="300px"> </telerik:RadTextBox></td>
                <td valign="middle"><img id="imgPartners" onclick="window.radopen(null, 'tbPartnersDialog');" src="images/search_icon.gif" align="absbottom" runat="server" /> </td>
                <td valign="middle" width="300px" nowrap="nowrap"><asp:Label ID="lblPartnerStatus" runat="server"></asp:Label>
                    <asp:Label ID="lblPartnerID" runat="server" Visible="false"></asp:Label></td>
              </tr>
            </table></td>
          </tr>         
        </table></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
    </table>
    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server"  >
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="tbInvestors">
                 <UpdatedControls>                  
                     <telerik:AjaxUpdatedControl ControlID="tbInvestors" />
                     <telerik:AjaxUpdatedControl ControlID="lblInvestorStatus" />
                     <telerik:AjaxUpdatedControl ControlID="lblInvestorID" />                 
                 </UpdatedControls>
             </telerik:AjaxSetting>       
        </AjaxSettings>        
    </telerik:RadAjaxManagerProxy>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" VisibleStatusbar="False"
        Behaviors="Default" InitialBehaviors="None" Left=""
        Skin="Outlook" style="display: none;" Top="" >
        <Windows>
            <telerik:RadWindow  id="tbOwnersDialog" Runat="server"
                OnClientClose="populateSelectedOwners" Width="400px" Height="300px"
                Title="Select Investors" NavigateUrl="Windows/SelectOwners.aspx" />
            <telerik:RadWindow  id="tbInvestorsDialog" Runat="server"
                OnClientClose="populateSelectedInvestors" Width="400px" Height="300px"
                Title="Select Investors"    NavigateUrl="Windows/SelectPartners.aspx" />            
            <telerik:RadWindow  id="tbPartnersDialog" Runat="server"
                OnClientClose="populateSelectedPartners" Width="400px" Height="300px"
                Title="Select Investors"    NavigateUrl="Windows/SelectPartners.aspx?InvestorTypeID=2" />
        </Windows>
    </telerik:RadWindowManager>
   
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
</asp:Content>


2 Answers, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 27 Jul 2010, 02:12 PM
You have to place you script code inside of  a RadScriptBlock on your child page.

Like so:

<telerik:RadScriptBlock ID="scbScripts" runat="server"
<script type="text/javascript">
        function populateSelectedOwners(sender, args) {
            var textBox;
            textBox = $find("<%= tbOwners.ClientID %>");
            textBox.set_value(args.get_argument());
  
            return false;
        }
        function populateSelectedInvestors(sender, args) {
            var textBox;
            textBox = $find("<%= tbInvestors.ClientID %>");
            textBox.set_value(args.get_argument());
  
            return false;
        }
        function populateSelectedPartners(sender, args) {
            var textBox;
            textBox = $find("<%= tbPartners.ClientID %>");
            textBox.set_value(args.get_argument());
  
            return false;
        }
    </script>
</telerik:RadScriptBlock>


I hope that helps.
0
Deepak
Top achievements
Rank 1
answered on 27 Jul 2010, 07:02 PM
Thanks a lot.
It works now.

Thanks Again.
Tags
Ajax
Asked by
Deepak
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
Deepak
Top achievements
Rank 1
Share this question
or