Can not find control in RadAjaxPanel for content page

2 posts, 1 answers
  1. Lubna Ansari
    Lubna Ansari avatar
    65 posts
    Member since:
    Feb 2010

    Posted 11 Mar 2010 Link to this post

    Hi,

    I am using a master content page.  I am able to find the controls on content page which are outside AjaxPanel but not which are inside.


    <%

    @ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" MasterPageFile="~/MasterPage.master" %>

     

    <%

    @ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

     

    <

     

    asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server" ID="Cnt1">

     

    <

     

    telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnablePageMethods="true"></telerik:RadScriptManager>

     

     

     


    <
    asp:TextBox ID="txtTest" runat="server" Text="abc">

     

     

    </asp:TextBox>

     

     

    <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1" LoadingPanelID="LoadingPanel1">

     

     

    <telerik:RadTextBox ID="txtRad" runat="server" Text="xyz"></telerik:RadTextBox>

     

     

    </telerik:RadAjaxPanel>
    <

     

    script type="text/javascript">

     

    alert(document.getElementById(

    "<%=txtRad.ClientID%>").value);

     

     

    </script>

     

     

     

    </asp:Content>


    I am getting error

     

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

    Below is my Master Page code

     

    <%

    @ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

     

    <%

    @ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

     

    <!

     

    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 runat="server">

     

     

    <title>Untitled Page</title>

     

     

    <asp:ContentPlaceHolder id="head" runat="server">

     

     

    </asp:ContentPlaceHolder>

     

    </

     

    head>

     

    <

     

    body>

     

     

    <form id="form1" runat="server">

     

     

    <div>

     

     

    <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">

     

     

     

    </asp:ContentPlaceHolder>

     

     

    </div>

     

     

    </form>

     

    </

     

    body>

     

    </

     

    html>

     

     

     

    How to find the control in RadAjaxPanel??

  2. Answer
    robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 11 Mar 2010 Link to this post

    Place your script block in a RadScriptBlock control.

    I hope that helps.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top