Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Editor > The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

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

Feed from this thread
  • nabrz avatar

    Posted on Nov 7, 2006 (permalink)

    Hello All,
    I was using Rad editor 5.6.4.0 and it was working fine with page that uses master page and also in normal page(which does not have master page)
    but now i just replace DLL and radcontrol folder with the 6.6.1.0 version of RAD editor.it works fine in normal page  but it does not work with the page that is using master page..
    please help me..
    thanks in advance

  • Ubong Ubong admin's avatar

    Posted on Nov 7, 2006 (permalink)


    Hi Nab,

    You need to move the script block out of the head tag and place it in the body tag and you should not face any problems.
    The problem is due to the runat="server" clause in the head tag and is related to ASP.NET 2.0 not allowing this syntax. I assume that is, that you are using NET2.0 as you have not specified your framework.


    Sincerely yours,
    Ubong
    the telerik team

  • nabrz avatar

    Posted on Nov 8, 2006 (permalink)

    Hi Ubong,
    Yes i am using ASP.NET 2.0
    I remove runat="server" from head tag and it work

    thank you so much

    Nab

  • kerstin Intermediate avatar

    Posted on Feb 13, 2008 (permalink)

    I just downloaded Prometheus and i have the same error. I am using the ASP.NET 2.0 Framework

  • kerstin Intermediate avatar

    Posted on Feb 13, 2008 (permalink)

    I receive the error:

    This page is missing a HtmlHead control which is required for the CSS stylesheet link that is being added. Please add <head runat="server" />.


    i also need the ability to change the page title...

  • George George admin's avatar

    Posted on Feb 14, 2008 (permalink)

    Hi kerstin,

    Please make sure that you have a head tag in your code and all your stylesheets are placed into the head. Here is a sample markup for achieving this goal:

    <head runat="server">  
        <title>PAGE TITLE</title> 
        <link href="styles.css" type="text/css" /> 
    </head> 

    Where your <link> and <tile> tags ar placed into the <head>.

    Kind regards,
    George
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

  • kerstin Intermediate avatar

    Posted on Feb 14, 2008 (permalink)

    Yes they are all placed in the head tag. i also tried to remove the runat="server" like mentioned in a thread earlier but no luck...

  • George George admin's avatar

    Posted on Feb 15, 2008 (permalink)

    Hi kerstin,

    We are unable to reproduce the reported behavior. Please note this error may occur due to various reasons and that is why we kindly request you to prepare a sample runnable project demonstrating your issue. Then we will be able to give you a proper reply right away.

    Greetings,
    George
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

  • Scott LeMay avatar

    Posted on May 1, 2008 (permalink)

    Replace all your <%=  %> tags with <%#  %>

    Rick Strahl does a good job of explaining this in his blog post..

    http://www.west-wind.com/weblog/posts/5758.aspx


  • Posted on Jun 10, 2008 (permalink)

    I have same issue but from diff source.

    <

    telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">

    <AjaxSettings>

    <telerik:AjaxSetting AjaxControlID="rgSearchResult">

    <UpdatedControls>

    <telerik:AjaxUpdatedControl ControlID="rgSearchResult" />

    </UpdatedControls>

    </telerik:AjaxSetting>

    </AjaxSettings>

    </telerik:RadAjaxManager>


    The moment I place above code in my CONTENT page prior to my RADGrid Tags I get the same error.

    Server Error in '/' Application.


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

  • Georgi Tunev Georgi Tunev admin's avatar

    Posted on Jun 11, 2008 (permalink)

    Hello MeetJayBlack,

    The error indicates that you have some code using <% %> in your page's head section. To avoid it, I would suggest to use RadCodeBlock and RadScriptBlock.


    Sincerely yours,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

  • Kenyon Fox avatar

    Posted on Aug 8, 2008 (permalink)

    This suggestion worked great for me.  I am using a master page and content pages.  I am also using Peter Blum's data validations suite which requires that you place the following in the <head> tag:

    <%= PeterBlum.DES.StyleSheetManager.GetLinkTags() %>

    I was getting the same error as all the other posts here and simply changed it to:

    <%# PeterBlum.DES.StyleSheetManager.GetLinkTags() %>

    This solved all my issues.

  • Robert avatar

    Posted on Jan 28, 2009 (permalink)

    Thank you for your suggestion to replace = with #. I can't say i'm a javascript ranger, but all the Telerik samples failed for me with the error about the code blocks <% error when run outside of the sample viewer. I replace = with the databinding # and all was well in my actual project. Yes, using ASP.Net 2.0 and the such.

  • chithuraj avatar

    Posted on Mar 2, 2009 (permalink)


      var oConatctName = document.getElementById('<%#EtxtContactName.ClientID%>').value;

    I u get the value like this please change it to

      var oConatctName = document.getElementById('EtxtContactName').value;

    Then it will works

    Thanks
    chithuraj.J



  • Moises avatar

    Posted on Jun 23, 2009 (permalink)

    Hi, i am using .net 3.5. I have the same problem. I have CSS references for all de application who need the runat="server" tag. Please, help.

  • ashish avatar

    Posted on Jun 27, 2009 (permalink)

    you have no idea buddy but right now u r my hero..

    i've been trying to remove this error since last 2 days.....

    thnx for the post..

  • chithuraj avatar

    Posted on Jul 1, 2009 (permalink)

    Hi Ashish,
      Sorry For Late reply. U just put your <script> tag at the end of the codein aspx page , Then it will works
    and  use like this for javasctipt to assign value.

    document.getElementById(

    '<%=hdnCompanyName.ClientID%>').value

     

     

  • Alaa Majzoub avatar

    Posted on Oct 13, 2009 (permalink)

    i am getting this error when using AjaxPanel and AjaxLoadingPanel
    The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). Stack Trace: at System.Web.UI.ControlCollection.Add(Control child) at Telerik.Web.UI.RadAjaxControl.CreateUpdatePanel(Control initiator, String eventName, Control updated, UpdatePanelRenderMode panelRenderMode) at Telerik.Web.UI.RadAjaxControl.OnPagePreRender(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.UI.Control.OnPreRender(EventArgs e) at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    the strange thing is that i dont have any scripts in the header of the master page, only a javascript file include tag. when i remove the runat=server property i get the other error: Using themed css files requires a header control on the page. (e.g. <head runat="server" />). Stack Trace: at System.Web.UI.PageTheme.SetStyleSheet() at System.Web.UI.Page.OnInit(EventArgs e) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    the strange thing too, is that it was working when we used the older version of Telerik, but now with the new version, we are getting this.




  • Georgi Tunev Georgi Tunev admin's avatar

    Posted on Oct 15, 2009 (permalink)

    Hello Alaa,

    Try wrapping the <script> block with a RadCodeBlock or RadScriptBlock (depending on the setup) and see if it helps. If you still experience problems after that, it will be best to open a support ticket and send us a project that reproduces the issue so we could examine it.


    Sincerely yours,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

  • Kelvin avatar

    Posted on Mar 23, 2010 (permalink)

    Let me continue with this thread, indeed we need to wrap the below code under the telerik:RadCodeBlock section

     

    var grid = $find("<%= grid1.ClientID %>"); 

     

    If not you will hit the The Controls collection cannot be modified because the control contains code blocks error.

     

  • Megan Vee avatar

    Posted on May 12, 2010 (permalink)

    Even remove the codeblock from commented out lines of code.

  • Purushottam avatar

    Posted on Jun 28, 2010 (permalink)

    I am trying to load a user control and facing the same issue

    protected

     

    void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args)

     

    {

     

    if (args.TargetControlID.IndexOf("TransactionId") != -1)

     

    {

     

    int index = args.TargetControlID.LastIndexOf("_");

     

     

    if (index != -1)

     

    {

     

    int transactionId;

     

     

    if (Int32.TryParse(args.TargetControlID.Substring(index + 1), out transactionId))

     

    {

    AddReplyBloop.TransactionId = transactionId;

    AddReplyBloop.Visible =

    true;

     

     

    args.UpdatePanel.ContentTemplateContainer.Controls.Add(AddReplyBloop);

    }

    }

    }

    }

    I can't remove the runat ="server" from head tag since we are writing title within the code.

    Please help!!!

  • Svetlina Anati Svetlina Anati admin's avatar

    Posted on Jun 28, 2010 (permalink)

    Hello Purushottam,

    As far as I can see form your code you are using RadToolTipManager and you load the desired content on demand by using AJAX. However, the code you provided does not contain any scripts and I assume that you have the script registered inline in the user control. If so, please note that when the tooltip manager loads the content with AJAX, it actually uses an inner asp update panel and MS AJAX does not parses scripts due to using innerHTML. This is not directly related to RadControls but to how the MS AJAX works and it could be reproduced by using only a standard update panel instead of a tooltip manager. More information about this known AJAX problem is available on the net, e.g below:

    http://www.google.bg/#hl=bg&rlz=1W1ADFA_en&q=ajax+execute+script&aq=f&aqi=&aql=&oq=&gs_rfai=&fp=ecfe930c3066f54e

    We have also prepared a blogpost for such cases - it is available below:

    http://blogs.telerik.com/tervelpeykov/posts/08-10-20/ajax_using_ajax_to_load_a_usercontrol_that_has_javascript_declared_in_it.aspx

    Note, that the approach provided in our blogpost works for common case and if your particular case is more complex I recommend to register the script from code behind as shown below:

       
    ScriptManager.RegisterClientScriptBlock(this, GetType(), key, script, addScriptTags);   

    In case this is not your scenario or I have misunderstood you, please provide more details and sample fully runnable reproduction code and we will do our best to help.


    Regards,
    Svetlina
    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

  • Purushottam avatar

    Posted on Jun 28, 2010 (permalink)

    Hi Svetlina,

    Thanks for quick response.

    this is the html code of the AddReplyBloop which is getting added to the update panel. It is using telerik

    <%

    @ Control Language="C#" AutoEventWireup="true" Inherits="UserControls_Trades_ReplyBloop" Codebehind="ReplyBloop.ascx.cs" %>

     

    <%

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

     

    <%

    --<asp:ScriptManagerProxy ID="smFeedbackReplyBloop" runat="server"></asp:ScriptManagerProxy>--%>

     

     

    <telerik:radajaxmanagerproxy id="ramFeedbackReplyBloop" runat="server">

     

     

    <AjaxSettings>

     

     

    <telerik:AjaxSetting AjaxControlID="btnAdd">

     

     

    <UpdatedControls>

     

     

    <telerik:AjaxUpdatedControl ControlID="btnAdd" />

     

     

    </UpdatedControls>

     

     

    </telerik:AjaxSetting>

     

    </

     

    AjaxSettings>

     

    </

     

    telerik:radajaxmanagerproxy>

     

     

     

     

     

    <table style="width:280px">

     

     

    <tr>

     

     

    <td style="color: #A6A6B4;background-color:#F2F2F2;padding:5px;">Reply To Feedback</td>

     

     

    </tr>

     

     

    <tr>

     

     

    <td style="padding-top:10px;">

     

     

    <asp:TextBox ID="txtAddReply" TextMode="MultiLine" Rows="5" Width="280px" BorderColor="black" BorderStyle="solid" BorderWidth="1px" ForeColor="black" Height="50px" MaxLength="80" runat="server">

     

     

    </asp:TextBox>

     

     

    </td>

     

     

    </tr>

     

     

    </table>

     

     

     

    <div style="margin-top:10px;"><asp:Button ID="btnSaveReply" BackColor="#0481F1" ForeColor="white" BorderColor="#0357A3" BorderStyle="solid" Font-Bold="true" BorderWidth="1px" cssclass="btnAddCollection" runat="server" Text="Save Reply" OnClientClick="if(!SaveReply()) return false;" OnClick="btnSaveReply_Click" CausesValidation="false" /></div>

     

  • Svetlina Anati Svetlina Anati admin's avatar

    Posted on Jun 30, 2010 (permalink)

    Hi Purushottam,

    I do not see any script which might cause the problem. Did you read the provided articles and did you try the my suggestions? In case you need further assistance, please provide the following:

    1) Make a sample demo which is fully runnable - both the aspx and the user control. Remove the database, just tooltipify a simple asp hyperlink and show the user control in it in the same manner you have done.

    2) Share all the code - both aspx and ascx and the relevant code-behind of the sample demo here. Make sure that it can be directly run without any modifications.

    3) Attach a screenshot of the error from the exact same demo you attach.

    Once you provide this, I will be able to prepare and debug a sample demo based on your code and I will fix it for you. After that you will be able to apply the same fix for your original application.

    All the best,
    Svetlina
    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

  • Alan avatar

    Posted on Nov 8, 2010 (permalink)

    I find it hard to believe I'm the first one to say this, but all these work-arounds seem fairly ridiculous.  I haven't yet tried them, but wouldn't any of the proposed work-arounds include a performance penalty, however slight?  It seems rather ridiculous to have to incur these penalties because a third-party control does things differently.  I'm just evaluating the Telerik components at this point, but that's a minus on the score card.

  • Svetlina Anati Svetlina Anati admin's avatar

    Posted on Nov 9, 2010 (permalink)

    Hello Alan,

     This thread was started about using code-block (<%%>) and this is general technique for evaluating server code in markup. Is this the topic you are talking about or not? Please, provide exact details what exactly you mean because different people with different scenarios and even for different controls has used this thread and thus we are not sure what is  your exact problem.

    Kind regards,
    Svetlina
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  • vishal avatar

    Posted on Feb 11, 2011 (permalink)

    Hello All,

    im also getting same error. I want to add gridview into update panel. But getting error. Please help

    UpdatePanel

     

     

    up1 = new UpdatePanel();

     

     

     

     

    gvPSE.Rows[CurRow].Cells[Col_L2].Style.Add(

     

    "white-space", "nowrap");

     

     

    gvPSE.Rows[CurRow].Cells[Col_L1].ColumnSpan = 4;

     

    gvPSE.Rows[CurRow].Cells[Col_L2].Visible =

     

    false;

     

     

    gvPSE.Rows[CurRow].Cells[Col_L3].Visible =

     

    false;

     

     

    gvPSE.Rows[CurRow].Cells[Col_L4].Visible =

     

    false;

     

     

    gvPSE.Rows[CurRow].Font.Bold =

     

    true;

     

     

    strRowIdTitleSub1 = gvPSE.Rows[CurRow].Cells[Col_ACCATCODE].Text.Replace(

     

    " ", "_").Trim();

     

     

    strRowIdTitleSub1 = gvPSE.Rows[CurRow].Cells[Col_ACCATCODE].Text;

     

    strRowIdTitleSub1 = strRowIdTitleSub1.Replace(

     

    "nbsp;", "");

     

     

    strRowIdTitleSub1 = strRowIdTitleSub1.Trim();

     

    strRowIdTitleSub1 = strRowIdTitleSub1.Replace(

     

    "amp;", "");

     

     

    strRowIdTitleSub1 = strRowIdTitleSub1.Trim();

     

    gvPSE.Rows[CurRow].ID =

     

    "__" + strRowIdTitleSub1;

     

     

    imgId =

     

    "img" + strRowIdTitleSub1;

     

     

    strImg =

     

    "<img id=" + imgId + " src='PlusSign.JPG'";

     

     

    FirstParam = strRowIdTitleSub1;

     

    SecondParam = imgId;

     

    ThirdParam = strRowIdTitleSub1;

     

    StrScript =

     

    "javascript:HdnTblPlsMisTR('" + imgId + "','" + ThirdParam + "')";

     

     

    strImg =

     

    "<a target='' return false;" + " > " + strImg + " name='imgPMP' onclick=" + "\"" + StrScript + "\"" + "/>" + "</a>";

     

     

    gvPSE.Rows[CurRow].Cells[Col_L1].Text = strImg +

     

    "&nbsp;&nbsp;" + gvPSE.Rows[CurRow].Cells[Col_L1].Text;

     

     

     

     

     

     

    ////Hrs

     

     

     

    if (Col_Hrs != 0)

     

     

    {

     

     

     

    if (gvPSE.Rows[CurRow].Cells[Col_Hrs].Text != "")

     

     

     

     

    if (gvPSE.Rows[CurRow].Cells[Col_L1].Text.Contains("Project Co-ordination"))

     

     

    gvPSE.Rows[CurRow].Cells[Col_Hrs].Text =

     

    "";

     

     

     

     

    else

     

    gvPSE.Rows[CurRow].Cells[Col_Hrs].Text =

     

    string.Format(objCultureInfo, "{0:c}", Convert.ToDouble(gvPSE.Rows[CurRow].Cells[Col_Hrs].Text));

     

     

    gvPSE.Rows[CurRow].Cells[Col_Hrs].ColumnSpan = 2;

     

    //3

     

    gvPSE.Rows[CurRow].Cells[Col_LH1].Visible =

     

    false; //4

     

    gvPSE.Rows[CurRow].Cells[Col_Hrs].CssClass =

     

    "TdSerEst"; ;

     

     

    }

     

     

     

    //Modified

     

     

     

    if (Col_Modified != 0)

     

     

    {

     

     

     

    if (gvPSE.Rows[CurRow].Cells[Col_Modified].Text != "")

     

     

    gvPSE.Rows[CurRow].Cells[Col_Modified].Text =

     

    string.Format(objCultureInfo, "{0:c}", Convert.ToDouble(gvPSE.Rows[CurRow].Cells[Col_Modified].Text));

     

     

    gvPSE.Rows[CurRow].Cells[Col_Modified].ColumnSpan = 2;

     

    //7

     

    gvPSE.Rows[CurRow].Cells[Col_LM1].Visible =

     

    false; //8

     

    gvPSE.Rows[CurRow].Cells[Col_Modified].CssClass =

     

    "TdSerEst"; ;

     

     

    }

     

     

     

    //Tuning

     

     

     

    if (Col_tun != 0)

     

     

    {

     

     

     

    if (gvPSE.Rows[CurRow].Cells[Col_tun].Text != "")

     

     

    gvPSE.Rows[CurRow].Cells[Col_tun].Text =

     

    string.Format(objCultureInfo, "{0:c}", Convert.ToDouble(gvPSE.Rows[CurRow].Cells[Col_tun].Text));

     

     

    gvPSE.Rows[CurRow].Cells[Col_tun].ColumnSpan = 2;

     

    //10

     

    gvPSE.Rows[CurRow].Cells[Col_LT1].Visible =

     

    false; //11

     

    gvPSE.Rows[CurRow].Cells[Col_tun].CssClass =

     

    "TdSerEst"; ;

     

     

    }

     

     

     

    //Final hr

     

     

     

    if (Col_F_Hrs != 0)

     

     

    {

     

     

     

    if (gvPSE.Rows[CurRow].Cells[Col_F_Hrs].Text != "")

     

     

    gvPSE.Rows[CurRow].Cells[Col_F_Hrs].Text =

     

    string.Format(objCultureInfo, "{0:c}", Convert.ToDouble(gvPSE.Rows[CurRow].Cells[Col_F_Hrs].Text));

     

     

    gvPSE.Rows[CurRow].Cells[Col_F_Hrs].ColumnSpan = 2;

     

    //13

     

    gvPSE.Rows[CurRow].Cells[Col_LFH1].Visible =

     

    false; //14

     

    gvPSE.Rows[CurRow].Cells[Col_F_Hrs].CssClass =

     

    "TdSerEst"; ;

     

     

    }

     

     

     

    //Cost

     

     

     

    if (Col_Cost != 0)

     

     

    {

     

     

     

    if (gvPSE.Rows[CurRow].Cells[Col_Cost].Text != "")

     

     

    gvPSE.Rows[CurRow].Cells[Col_Cost].Text =

     

    string.Format(objCultureInfo, "{0:c}", Convert.ToDouble(gvPSE.Rows[CurRow].Cells[Col_Cost].Text));

     

     

    gvPSE.Rows[CurRow].Cells[Col_Cost].ColumnSpan = 2;

     

    //21

     

    gvPSE.Rows[CurRow].Cells[Col_LC1].Visible =

     

    false; //22

     

    gvPSE.Rows[CurRow].Cells[Col_Cost].CssClass =

     

    "TdSerEst"; ;

     

     

    }

     

     

     

    //List

     

     

     

    if (Col_List != 0)

     

     

    {

     

     

     

    if (gvPSE.Rows[CurRow].Cells[Col_List].Text != "")

     

     

    gvPSE.Rows[CurRow].Cells[Col_List].Text =

     

    string.Format(objCultureInfo, "{0:c}", Convert.ToDouble(gvPSE.Rows[CurRow].Cells[Col_List].Text));

     

     

    gvPSE.Rows[CurRow].Cells[Col_List].ColumnSpan = 2;

     

    //24

     

    gvPSE.Rows[CurRow].Cells[Col_LL1].Visible =

     

    false; //25

     

    gvPSE.Rows[CurRow].Cells[Col_List].CssClass =

     

    "TdSerEst"; ;

     

     

    }

     

    gvPSE.Rows[CurRow].HorizontalAlign =

     

    HorizontalAlign.Right;

     

     

    gvPSE.Rows[CurRow].Cells[Col_L1].HorizontalAlign =

     

    HorizontalAlign.Left;

     

     

    up1.ContentTemplateContainer.Controls.Add(gvPSE.Rows[CurRow]);

     

    Page.Form.Controls.Add(up1);

  • Bill avatar

    Posted on Feb 28, 2011 (permalink)

    This fixed it for me:

    I am also using DotNetNuke so enclosing all scripts in codeblocks is absolutely not an option.
    Even if I was willing to do it, realizing all the changes would get lost on the next DNN update, I would not have a clue which DNN files would have to be modified.
    In my case, all was peachy if I had a RadAjaxPanel only around the Radgrid. It would update OK without a postback and not generate a page loading error (control contains code blocks (i.e. <% ... %>).
    As soon as I clicked the edit button on the grid however- which shows and hides various panels, I get the error.
    (I also had the same issue previously using Views instead of panels)

    Anyway, I removed the following asp TAG code on my page and all is well;

     <a target="_Reports" href="<%=GETreportURL() %>">

  • linh avatar

    Posted on Apr 24, 2011 (permalink)

    I tried many ways but i can't solve this problem. Help me.
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
                            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                                <AjaxSettings>
                                    <telerik:AjaxSetting AjaxControlID="RadListView1">
                                        <UpdatedControls>
                                            <telerik:AjaxUpdatedControl ControlID="RadListView1" LoadingPanelID="RadAjaxLoadingPanel1" />
                                        </UpdatedControls>
                                    </telerik:AjaxSetting>
                                </AjaxSettings>
                            </telerik:RadAjaxManager>
                            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" MinDisplayTime="0" />
                            <telerik:RadListView ID="RadListView1" runat="server" AllowPaging="True" BorderStyle="None"
                                PageSize="4">
                                <ItemTemplate>
                                    <div class="event-1">
                                        <div class="event-1-1">
                                            <p>
                                                <asp:Label ID="lbDate" runat="server" Text='<%# Eval("EventDate") %>' />
                                            </p>
                                        </div>
                                        <div class="event-1-2">
                                            <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# "EventDetail.aspx?eventID="+Eval("EventID") %>'
                                                Text='<%# Eval("EventTitle") %>'></asp:HyperLink>
                                            <br />
                                            <i>
                                                <asp:Label ID="lbContent" runat="server" Text='<%# Eval("Content") %>' />
                                                <br />
                                            </i><font style="color: grey">
                                                <asp:Label ID="lbTime" runat="server" Text='<%# Eval("EventTime") %>' />&nbsp;|
                                                <asp:Label ID="lbPlace" runat="server" Text='<%# Eval("EventPlace") %>' />
                                            </font>
                                        </div>
                                    </div>
                                </ItemTemplate>
                                <EmptyDataTemplate>
                                    This category is empty.
                                </EmptyDataTemplate>
                            </telerik:RadListView>
                            <telerik:RadDataPager ID="RadDataPager1" runat="server" PagedControlID="RadListView1"
                                PageSize="4">
                                <Fields>
                                    <telerik:RadDataPagerButtonField FieldType="FirstPrev" />
                                    <telerik:RadDataPagerButtonField FieldType="Numeric" />
                                    <telerik:RadDataPagerButtonField FieldType="NextLast" />
                                </Fields>
                            </telerik:RadDataPager>

  • <>< avatar

    Posted on Jun 20, 2011 (permalink)

    Hi,

    I seem the be facing the same issue, but for me it happens whenever I try to Ajaxify an item in a user control.

    For example, I have a user control that I use on the main page. In the user control, I am trying to Ajaxify a timer using the AjaxMangerProxy:

    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="timerPostRead">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panelTimer" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>

    The user control itself has some code blocks, for example:
     
    <asp:Panel ID="panelTimer" runat="server">
        <asp:Timer ID="timerPostRead" runat="server" Enabled="false" Interval="5000" />
    </asp:Panel>
      
    <%If Not post is Nothing Then %>
        <div style="padding:7px;">
              stuff here....
        </div>
    <%End If%>

    I tried using a RadAjaxPanel instead, but faced the same issue.  If I remove the AjaxManagerProxy or the AjaxPanel, everything works fine.

    Take Care

  • Georgi Tunev Georgi Tunev admin's avatar

    Posted on Jun 21, 2011 (permalink)

    Hello <><,

    Please check the following help article for more information on how to avoid such problem:
    http://www.telerik.com/help/aspnet-ajax/ajax-radscriptblock-radcodeblock.html


    Greetings,
    Georgi Tunev
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Editor > The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).