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

The Controls collection cannot be modified because the control contains code blocks Error..

52 Answers 2469 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Jason Maronge
Top achievements
Rank 1
Jason Maronge asked on 25 Apr 2007, 12:11 AM
I am trying to change to the new AjaxManager and AjaxPanel and right off the bat I am getting the following error:

Source: System.Web
Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Inner Exception: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Stack Trace: at System.Web.UI.ControlCollection.AddAt(Int32 index, Control child) at Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) at Telerik.Web.UI.RadAjaxControl.PerformRender() at Telerik.Web.UI.RadAjaxControl.OnPageRender(HtmlTextWriter writer, Control page) at Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at System.Web.UI.Page.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Form:
Query String:
Target Site: Boolean HandleError(System.Exception)


All i have done is change the radA:RadAjaxPanel to telerik:RadAjaxPanel.  I also added the <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> tag to the top of the page.  I also put a ScriptManager on the page.  Is there something I missed?

Thanks,  Jason

52 Answers, 1 is accepted

Sort by
0
RichJ
Top achievements
Rank 1
answered on 25 Apr 2007, 03:44 AM
Hi Jason,

Try removing the runat=server from the <head> tag in your document.
I've just resolved this with a standard RAD ASP.NET control.

Rich
0
Vlad
Telerik team
answered on 25 Apr 2007, 07:27 AM
Hello Jason,

If you have any code blocks you can enclose them using telerik:RadCodeBlock tag.

Best regards,
Vlad
the telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jason Maronge
Top achievements
Rank 1
answered on 25 Apr 2007, 01:53 PM
I added a RadCodeBlock around my javascript section and that seemed to fix it. 

Thanks...  Jason
0
SamVanity
Top achievements
Rank 2
answered on 26 Apr 2007, 01:01 PM
I am getting this error too. And I don't have code blocks at all. The following is the code:

                <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server"
                    <asp:Label ID="noAvatarWarn" runat="server" /> 
                    <asp:Image ID="avatar" runat="server" /> 
                    <asp:Image ID="offlineAvatar" runat="server" /> 
                    <asp:Button ID="Button2" runat="server" Text="Button" SkinID="hiddenbutton" /> 
                </telerik:RadAjaxPanel> 

by the way, I originally coded this part with RadAjaxPanel, and everything worked fine.
0
Vlad
Telerik team
answered on 26 Apr 2007, 01:30 PM
Hello Sam,

Do you have "Theme" applied on your page - this may cause such exception. You can post the entire page declaration to give you more to-the-point explanation.

Best regards,
Vlad
the telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
SamVanity
Top achievements
Rank 2
answered on 26 Apr 2007, 02:40 PM
yes, I do have theme applied to the page. What should I watch out for?

The page is in nested masterpages (2) as well. The only relevant thing is

<asp:Button runat="server" CssClass="hiddenButtons" skinId="hiddenbutton" />

as in the skin file. I don't apply skin to the telerik.radajaxpanel.

The page is too huge to post on the forum.
0
Vlad
Telerik team
answered on 27 Apr 2007, 11:45 AM
Hi Sam,

I tried to replicate this unfortunately to no avail - it seems that the source of the problem is somewhere else. You can find small demo attached.

Sincerely yours,
Vlad
the telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
SamVanity
Top achievements
Rank 2
answered on 27 Apr 2007, 02:50 PM
I do have a script block containing <%%> outside of the new RadAjaxPanel. do I have to enclose those in RadCodeBlock? They are not inside the AjaxPanel though.

I did try enclosing the script block I have with RadCodeBlock but it still does not work (same error message).

What about script blocks in the masterpage? Do I have to worry about those?
0
Konstantin Petkov
Telerik team
answered on 27 Apr 2007, 03:41 PM
Hello Sam Van,

Yes, you must enclose those code blocks within telerik:RadCodeBlock tag. If that does not help, would you please isolate the issue as much as possible and send the code via support ticket?

Thank you in advance for your cooperation.

Kind regards,
Konstantin Petkov
the telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Todd Anglin
Top achievements
Rank 2
answered on 27 Apr 2007, 03:44 PM
Konstantin-

Can you take a moment and explain why RadCodeBlocks are necessary with the new "Prometheus" RadAjax? I don't think the documentation has much on these new controls yet and they seem to be a point of confusion.

Thanks~
Todd

0
SamVanity
Top achievements
Rank 2
answered on 27 Apr 2007, 08:45 PM
exactly. We do need more information regarding this RadCodeBlock thing. There is not much about the use and reason for this in the document at all. And again, do I have to worry about those script blocks in the masterpage / user control ?
0
Konstantin Petkov
Telerik team
answered on 30 Apr 2007, 07:58 AM
Hi Sam, Todd,

The way script blocks are implemented in ASP.NET may interfere with ajax manager's render interception mechanism. Đ¢hat is why we have created the workaround of enclosing script blocks in a RadCodeBlock control. Moving scripts inside a RadCodeBlock control will isolate the effects to that control only and the partial rendering code will not be affected.

Sam, please enclose all those scripts in RadCodeBlock even at your MasterPage/WebUserControl.

Kind regards,
Konstantin Petkov
the telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ken Fleming
Top achievements
Rank 1
answered on 01 May 2007, 03:42 PM
For what it's worth this error also happens if the "code block" is in a javascript on the page (e.g. ajaxRequest = <%=Radmanager.ClientID%>).
0
Ronaldo
Top achievements
Rank 1
answered on 10 Oct 2007, 12:14 AM
I'm so sorry but can you please show a sample syntax on how and where to put the "telerik:RadCodeBlock" tag?
for example:
window["<%= rgdContactPerson.ClientID %>"].AjaxRequest("<%= rgdContactPerson.UniqueID %>", "CloseForm");

Thanks!
0
Atanas Korchev
Telerik team
answered on 10 Oct 2007, 05:55 AM
Hello Ronaldo,

Here is an example:

<head runat="server"
    <telerik:RadCodeBlock runat="server"
        <script type="text/javascript"
            function MyFunction () 
            { 
            } 
        </script> 
    </telerik:RadCodeBlock> 
</head> 

Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
UT_DEV
Top achievements
Rank 1
answered on 28 Nov 2007, 10:10 AM
So as I understand this block <telerik:RadCodeBlock runat="server">
must be applied to any javascript that is dealing with telerik prometheus controls. Is it correct
0
Sebastian
Telerik team
answered on 28 Nov 2007, 10:46 AM
Hello Ilya,

Yes, this information is correct. Generally speaking, you should wrap any client-side code which contains server tags in RadScriptBlock. Review paragraph 6 of this help article for more info.

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
rh
Top achievements
Rank 1
answered on 04 Jan 2008, 03:40 AM
I think requiring the RadCodeBlock is unacceptable. I've been trying to "upgrade" to Prometheus but am unable to because I have dozens and dozens of usercontrols and hundreds of pages and I can't go into every page and usercontrol and add this RadCodeBlock tag around any of my script that uses the <%= %> syntax.
0
Konstantin Petkov
Telerik team
answered on 04 Jan 2008, 07:31 AM
Hi rh,

Unfortunately I have to agree with you -- this task is quite tedious in case of plenty of pages containing server code blocks. We will once again look into that and try to find another workaround.

Please, excuse us for the inconvenience.

Kind regards,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ambu
Top achievements
Rank 1
answered on 05 Mar 2008, 05:21 PM
I got my page to run by blocking out the javascript, but now the javascript seems to run after the AJAX runs. I did not have the problem with previous RadAjax. Please advise, this entire page may need to be recoded. 

RadAjaxPanel1.ResponseScripts.Add(

string.Format("hideDropDowns();"));


function hideDropDowns()

{

var ddlIDs = document.getElementById('<%= dropDownListIDs.ClientID %>');

var ids = ddlIDs.value.split(',');

for( var i = 0 ; i < ids.length ; i++)

{

if( ids[i] != '')

{

try {

var currentDropDown = document.getElementById(ids[i]);

currentDropDown.style.display =

"none";

currentDropDown.style.visibility =

"hidden";

}

catch(e) {};

}

}

}

0
Steve
Telerik team
answered on 06 Mar 2008, 09:21 AM
Hi Allan,

Can you elaborate on what do you mean by "I got my page to run by blocking out the javascript, but now the javascript seems to run after the AJAX runs"?

All the best,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ambu
Top achievements
Rank 1
answered on 06 Mar 2008, 01:17 PM
I blocked out the JavaScript using the RadCodeBlock tags. The page now loads with all the dropdowns visible and then quickly changes to hide them properly. This causes the page to load too wide and then fix itself. Before, the page would just load correctly from the start.


<

telerik:RadCodeBlock runat="server">

<

script language="javascript" type="text/javascript">

<!--

function displayDropDown(timeTypeDD, projectDD, sctsDD, otherDD)

{

var ddlIDs = document.getElementById('<%# dropDownListIDs.ClientID %>');

var selectedValue = timeTypeDD.value;

if (selectedValue == 1) {

projectDD.style.display =

"inline";

projectDD.style.visibility =

"visible";

projectDD.focus();

sctsDD.style.display =

"none";

sctsDD.style.visibility =

"hidden";

otherDD.style.display =

"none";

otherDD.style.visibility =

"hidden";

}

else if (selectedValue == 2) {

projectDD.style.display =

"none";

projectDD.style.visibility =

"hidden";

sctsDD.style.display =

"inline";

sctsDD.style.visibility =

"visible";

sctsDD.focus();

otherDD.style.display =

"none";

otherDD.style.visibility =

"hidden";

}

else if (selectedValue == 3) {

projectDD.style.display =

"none";

projectDD.style.visibility =

"hidden";

sctsDD.style.display =

"none";

sctsDD.style.visibility =

"hidden";

otherDD.style.display =

"inline";

otherDD.style.visibility =

"visible";

otherDD.focus();

}

}

function hideDropDowns()

{

var ddlIDs = document.getElementById('<%= dropDownListIDs.ClientID %>');

var ids = ddlIDs.value.split(',');

for( var i = 0 ; i < ids.length ; i++)

{

if( ids[i] != '')

{

try {

var currentDropDown = document.getElementById(ids[i]);

currentDropDown.style.display =

"none";

currentDropDown.style.visibility =

"hidden";

}

catch(e) {};

}

}

}

function focusCategory(categoryDD)

{

categoryDD.focus();

}

-->

</

script>

</

telerik:RadCodeBlock>


0
Iana Tsolova
Telerik team
answered on 06 Mar 2008, 05:25 PM
Hi Allan,

Unfortunately I was not able to reproduce your problem. I am attaching a sample project illustrating my approach to this forum post. Please tell us if we omitted something from your logic - this can lead us to the source of the issue to eliminate it accordingly.

Kind regards,
Iana
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ambu
Top achievements
Rank 1
answered on 06 Mar 2008, 05:34 PM
deleted post
0
Ambu
Top achievements
Rank 1
answered on 06 Mar 2008, 05:35 PM
deleted post
0
Ambu
Top achievements
Rank 1
answered on 06 Mar 2008, 11:28 PM
Iana,

I will build a demo app and create a new support ticket.

Thanks,
Allan
0
bradhh
Top achievements
Rank 2
answered on 30 Apr 2008, 08:49 PM
I am in the correct thread, just wanted to mention that since the red WARNING pops up here.

ASP.NET AJAX (formerly "Prometheus") is causing me problems. My site worked fine before I upgraded, but now some pages seem unable to load because of the error noted in this thread. Not all of my pages, but most of them. Some pages that have the RadAjaxManager seem to work fine, but others do not. Here is the call stack associated with this error:

[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]  
   System.Web.UI.ControlCollection.AddAt(Int32 index, Control child) +2108046  
   Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) +171  
   Telerik.Web.UI.RadAjaxControl.PerformRender() +373  
   Telerik.Web.UI.RadAjaxControl.OnPageRender(HtmlTextWriter writer, Control page) +1309  
   Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) +152  
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +98  
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20  
   System.Web.UI.Page.Render(HtmlTextWriter writer) +26  
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25  
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121  
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22  
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2558 

I find that the "workaround" you posted concerning the RadCodeBlock tag fixes my problem. This is completely unacceptable, as noted by Konstantin Petkov in the post of 1/4/2008 1:31:07 AM below. Konstantin acknowledged the unacceptable nature of this solution in early January, nearly four months ago, and still no solution has been found. This, also, is unacceptable.

I'm finding that my code works fine if I delete RadAjaxManager from the page. That seems like an odd solution for a set of controls that has AJAX in the name.

Should I just go back to the old version of the controls? Why then did I pay the subscription price?
0
Yavor
Telerik team
answered on 01 May 2008, 05:32 AM
Hi Brad,

Many of the controls no longer allow server code blocks (like window["<%=RadGrid1.ClientID%>"]) inside scripts residing in page head tag -- from now on they register their CSS files into page header. You need to either wrap the script inside additional PlaceHolder or move it into the page body instead. Nevertheless, I have passed your comments to our developers, for further consideration. Any additional details as to why you find the use of RadCodeBlock unacceptable would be appreciated.

Regards,
Yavor
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
bradhh
Top achievements
Rank 2
answered on 01 May 2008, 03:50 PM
I was very frustrated yesterday. Today I'm feeling much better, but I have to admit I haven't started working yet.  :)  Still, sorry about yesterday's rant.

However, I still have some issues with this whole situation. Asking us to move <script> blocks out of the <head> is not an acceptable solution. <script> blocks belong in the <head>, that's how HTML is set up.

Telling us we can't use code blocks (<%  %>) in our scripts is not acceptable either. You're saying that your ASP.NET AJAX controls don't support ASP.NET. If that's the case, then you really can't call them ASP.NET controls, can you?

Also, every example of the RadAjaxLoadingPanel I've seen on your site uses code blocks (<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>). If the RadAjaxManager is having trouble with code blocks, why is your RadAjaxLoadingPanel using them? All of your other controls seem to be able to find their images in the Telerik.dll file without using code blocks. Why does the RadAjaxLoadingPanel seem to be unable to do this? And do I need to wrap that code block in <RadCodeBlock> tags?

At this point I can get by with the <RadCodeBlock> tags in my code. I don't use many code blocks, since I try to follow the ASP.NET programming model of separating UI from business logic. Still, ASP.NET code blocks are an integral part of ASP.NET programming, as Telerik has demonstrated in the use of them in the RadAjaxLoadingPanel. I do hope that this issue gets resolved soon.

Thanks -
Brad
0
Yavor
Telerik team
answered on 02 May 2008, 05:43 AM
Hi Brad,

Thank you for your feedback.
I will pass it along to our development team. They will definately review it carefully, and consider a modification of the control for one of the upcoming versions.

Kind regards,
Yavor
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
David Bows
Top achievements
Rank 1
answered on 06 May 2008, 01:16 PM
I agree - the whole RadControlBlock thing is terrible.  This is a HUGE reason that I cannot take advantage of the new stuff.  Telerik you have to realize you have too many customers now to go and require them to make this type of change to stable applications to continue to use your controls.  It puts all of our applications at risk and cost a ton of money in testing and support.

David
0
cayates
Top achievements
Rank 1
answered on 07 May 2008, 02:45 PM
Hello, I am running into this same problem as well.  I would also like to express the same dissatisfaction that the others in this forum have expressed.  It was a very bad decision on the telerik developers part to force your customers to sourround all instances of <%= %> with the RadCodeBlock.  It should have been realized that this type of requirement would cause too many problems and too big of an inconvenience for customers with large projects who wants to upgrade.  It's an extra process to remember and keep track of.  The nature of asp.net lends itself to nested pages, objects, and reusable controls.  I have a feeling I will constantly be running into this error and subsequently having to search each layer of nested pages and web controls for <%=%> tags, what a pain!  Plus it clutters up the aspx file even more.

</rant>
0
ewart
Top achievements
Rank 1
answered on 20 May 2008, 11:21 PM
Thank goodness for this thread, I was able to wrap my JS with the RadCodeBlock and that worked.   At this stage I'm only converting 5 pages (of about 200) in the website.  I'm wondering if, during the future conversion process I should be using a different method instead of the code <% %> tags for locating my ajax object.

At the moment my JS code is like:

var ajaxManagerObject = window["<%= rAjax.ClientID  %>"]; // Locate AJAX Object

But perhaps there is a better way for future? 

cheers
ewart
0
Sebastian
Telerik team
answered on 21 May 2008, 05:58 AM
Hello ewart,

Better approach might be to use the $find method of the ASP.NET AJAX framework which is a shortcut for the findComponent() method. Review the code snippets from this topic in the online documentation for more info (it also outlines the changes we made compared to the Prometheus version of RadAjax):

http://www.telerik.com/help/aspnet-ajax/ajxmigration.html

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
wvanhooijdonk
Top achievements
Rank 1
answered on 26 Jun 2008, 07:40 AM
Where can I find any newsupdate on this (RadCodeBlock) issue?

I'm also having the same trouble like Jason with the exception 'The controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)' and I'm wordking in the 2008 Q1 HotFix.
I'm also using DotNetNuke which headers or code blocks I do not whish to touch. Everything worked fine with 2007 Q3...

Thanks in advance.
0
Yavor
Telerik team
answered on 30 Jun 2008, 10:10 AM
Hi,

At present, the only possibility to remove this exception is to wrap the relevant JavaScript code in a RadCodeBlock. I hope that this approach does not cause you any inconvenience.

Regards,
Yavor
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
wvanhooijdonk
Top achievements
Rank 1
answered on 30 Jun 2008, 10:51 AM
I'm sorry to say this, but this probably prevents me from using any Telerik controls from now on. This will likely be followed by removing our subscription.
Like I said: a developer is not always able to change third party scripts.
Please inform me of any improvements on this issue.
0
Konstantin Petkov
Telerik team
answered on 30 Jun 2008, 11:01 AM
Hello,

I'm afraid there is misunderstanding here. You don't have to change anything in the third-party control scripts. The error is resolved simply by wrapping anything containing the code block within RadCodeBlock. It won't change anything else either in the layout or in the modules functionality. The RadCodeBlock and RadScriptBlock are described in details here.

I hope this helps.

Sincerely yours,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
wvanhooijdonk
Top achievements
Rank 1
answered on 30 Jun 2008, 11:23 AM
Sorry if I misunderstood. I'd like to re-illustrate my problem here:
1. I use the Telerik controls within a DotNetNuke module. DNN uses script blocks which I don't want to change.
2. I don't use any code or script blocks myself (just Telerik controls like RadGrid, RadComboBox)
3. Version 2007 Q3 worked fine
4. Version 2008 Q1 gives me the 'The Controls collection cannot be modified...' error

This is the issue I was complaining about. At first, I understood that I needed to encapsulate the script DNN script blocks with RadScriptBlock, but now you say I 'don't have to change anything in the third-party control scripts'?
Please inform me about any misinterpretations and what I should do to get rid of this error.

Thanks,
Willem
0
Konstantin Petkov
Telerik team
answered on 30 Jun 2008, 11:37 AM
Hi,

What I meant is to wrap those code blocks you have in the header within RadCodeBlock to resolve the error. It won't change anything in the functionality as well as in the layout.

Alternatively, you can try disabling the page head update through the EnablePageHeadUpdate="false" RadAjaxControl setting.

Let us know whether this works for you.

Greetings,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
wvanhooijdonk
Top achievements
Rank 1
answered on 30 Jun 2008, 12:04 PM
Ok, I will rephrase my question: how can I wrap the DNN code blocks in the header without changing the DNN source (from within the DNN module)?
Thank you for your swift response.
0
Konstantin Petkov
Telerik team
answered on 01 Jul 2008, 07:05 AM
Hi wvanhooijdonk,

You cannot avoid changing the DNN module source. Have you tried EnablePageHeadUpdate="false" suggestion?

Sincerely yours,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jonathan
Top achievements
Rank 1
answered on 28 Aug 2008, 01:56 AM
Could you give me the exact syntax for wrapping the following code tags in <telerik:radcodeblock>

<

input class="norm" id="btnLookup1" onclick= "openLookupWindow('<%= ddlSearchField1.ClientID %>','<%= txtTerm1.ClientID %>');" type="button" value="..."/>

There is an AJAX manager on the page and the usual error occurs because of this line.

Thanks

0
Bodevain Svensson
Top achievements
Rank 1
answered on 28 Aug 2008, 07:53 AM
Based on the discussion in this thread, my assumption would be to wrap the entire input type="button" control inside RadCodeBlock. Another thing that should work would be to set runat=server attribute for this html input and assign the onclick handler on the server passing the clientids of the controls in question as arguments.

Bodevain
0
Andreas Ladis
Top achievements
Rank 1
answered on 31 Mar 2009, 03:25 PM

 

I added a RadCodeBlock around my javascript section and that seemed to fix it. 

Thanks...  Eleni
0
DK
Top achievements
Rank 2
answered on 09 Oct 2009, 03:52 AM
I have also added radcodeblock it works fine now.
but some panels are not updated with some controls/
why it is happening so?
i have a radcombobox and a text box .
on selected index change of the combobox i m  updating  a panel say panDetail and also on text change of the textbox i am updating the same panel.
it works fine for textbox but in case  of radcombobx the panel is not updated?
why so?
0
Todd Anglin
Top achievements
Rank 2
answered on 09 Oct 2009, 01:52 PM
DK-

A couple things to check:

  1. First, make sure that your Combobox works with a PostBack. If it works with a normal PostBack, it should continue to work when you add the "ajaxification."
  2. Second, one thing often overlooked with Combobox is the AutoPostBack property. Make sure AutoPostBack property is set to true on your RadCombobox to ensure a server event is fired when an action is performed.

Hope that helps.

-Todd
0
Todd Anglin
Top achievements
Rank 2
answered on 09 Oct 2009, 01:52 PM
DK-

A couple things to check:

  1. First, make sure that your Combobox works with a PostBack. If it works with a normal PostBack, it should continue to work when you add the "ajaxification."
  2. Second, one thing often overlooked with Combobox is the AutoPostBack property. Make sure AutoPostBack property is set to true on your RadCombobox to ensure a server event is fired when an action is performed.

Hope that helps.

-Todd
0
Juan
Top achievements
Rank 1
answered on 04 Mar 2011, 07:34 AM
Thanks Jason Maronge wrapping my code in the RadCodeBlock fix my problem. Im using ajax toolkit for the autocomplete extender and calendar extender. And with telerik the rad grid with nestedview. In my javascript Im accesing server controls id for the autocomplete behavior.
0
Mahesh
Top achievements
Rank 1
answered on 11 Jan 2013, 10:18 AM
Dear DK
I have the same problem .........
I am filling other combo on selected index change of another combo that combo not updated
kindly let me know if you got answer
0
Rama
Top achievements
Rank 1
answered on 17 Jan 2013, 07:20 AM
this solution is absolute for the problem .

Thanks

Rama
0
Tim
Top achievements
Rank 1
answered on 22 Apr 2013, 03:00 PM
Ok, here is a workaround.  This is what I did from a Website created in ASP.NET 4.5 using the standard built-in web template. 

Basically, the built-in template has a header like this:
<head runat="server">
    <title ><%: Page.Title %> - My Site</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
     
    <asp:PlaceHolder runat="server">
    <%: Scripts.Render("~/bundles/modernizr") %>
    </asp:PlaceHolder>
     
    <webopt:BundleReference runat="server" Path="~/Content/css" />
    <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <asp:ContentPlaceHolder runat="server" ID="HeadContent" />
</head>
So, you've added either a RadAjaxManager or RadAjaxPanel on your MasterPage or Form.  And you get the same error mentioned in this Thread.  So the recommendation is to remove the "runat=server" from your head tag which then breaks the whole site and causes all sorts of redesign, meetings, pulling of hair, nashing of teeth, etc.  Or, you implement this horrendous solution of wrapping RadCodeBlocks around everything and then you head tag looks like this:
<head runat="server">
    <telerik:RadCodeBlock runat="server">
    <title><%: Page.Title %> - My Site</title>
    </telerik:RadCodeBlock>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
     
    <telerik:RadCodeBlock runat="server">
    <asp:PlaceHolder runat="server">
    <%: Scripts.Render("~/bundles/modernizr") %>
    </asp:PlaceHolder>
    </telerik:RadCodeBlock>
     
    <telerik:RadCodeBlock runat="server">
    <webopt:BundleReference runat="server" Path="~/Content/css" />
    </telerik:RadCodeBlock>
    <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <asp:ContentPlaceHolder runat="server" ID="HeadContent" />
</head>

So then you realize you have to retrain all developers to NEVER use any standard built-in ASP.NET syntax such as "<%:" or "<%=", etc.  Then you realize, this doesn't make any sense, and you say to yourself: "I noticed that the placeholder control had a "runat=server" and without wrapping that control in a RadCodeBlock, everything worked just fine!".

Ahh, so now the solution presents itself.  All we need are server controls wrapping the elements giving us this problem!  But, I don't want to wrap my "title" and all my "H1-H6" tags with asp:Panel controls either!  So, here it is, the solution to all this mess...
simply set your elements to run from the server (ex. title runat='server').

And finally, the head tag which works with RadAjax!
<head runat="server">
    <title runat="server"><%: Page.Title %> - My Site</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
     
    <asp:PlaceHolder runat="server">
    <%: Scripts.Render("~/bundles/modernizr") %>
    </asp:PlaceHolder>
     
    <webopt:BundleReference runat="server" Path="~/Content/css" />
    <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <asp:ContentPlaceHolder runat="server" ID="HeadContent" />
</head>

And viola!  No RadCodeBlocks!!!

Now, this may not work in all situations, but it has saved me from over-complicating the simplest things in my site.
Tags
Ajax
Asked by
Jason Maronge
Top achievements
Rank 1
Answers by
RichJ
Top achievements
Rank 1
Vlad
Telerik team
Jason Maronge
Top achievements
Rank 1
SamVanity
Top achievements
Rank 2
Konstantin Petkov
Telerik team
Todd Anglin
Top achievements
Rank 2
Ken Fleming
Top achievements
Rank 1
Ronaldo
Top achievements
Rank 1
Atanas Korchev
Telerik team
UT_DEV
Top achievements
Rank 1
Sebastian
Telerik team
rh
Top achievements
Rank 1
Ambu
Top achievements
Rank 1
Steve
Telerik team
Iana Tsolova
Telerik team
bradhh
Top achievements
Rank 2
Yavor
Telerik team
David Bows
Top achievements
Rank 1
cayates
Top achievements
Rank 1
ewart
Top achievements
Rank 1
wvanhooijdonk
Top achievements
Rank 1
Jonathan
Top achievements
Rank 1
Bodevain Svensson
Top achievements
Rank 1
Andreas Ladis
Top achievements
Rank 1
DK
Top achievements
Rank 2
Juan
Top achievements
Rank 1
Mahesh
Top achievements
Rank 1
Rama
Top achievements
Rank 1
Tim
Top achievements
Rank 1
Share this question
or