I am trying to get functionality that used to work before Prometheus working using the new controls.
We need to dynamically populate a context menu based on which grid cell the right-click occurs upon. We have the context menu within a RadAjaxPanel and before we were using Javascript fired on the right-click to update the RadAjaxPanel, build the context menu, and then display the menu.
Now that we're using the Prometheus RadAjaxPanel and RadContextMenu I get this error at page load:
The Controls collection cannot be modified because the control contains
code blocks (i.e. <% ... %>).
Description:
An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error and
where it originated in the code.
Exception Details:
System.Web.HttpException: The Controls collection cannot be modified because
the control contains code blocks (i.e. <% ... %>).
Source
Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
|
Stack Trace:
[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) +207
Telerik.Web.UI.RadAjaxControl.PerformRender() +403
Telerik.Web.UI.RadAjaxControl.OnPageRender(HtmlTextWriter writer, Control page) +1473
Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) +124
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
|
If I replace the RadAjaxPanel with a Microsoft UpdatePanel the problem goes away. However, that creates another problem for us. During the server update of the update panel we place Javascript within it in order to display the context menu in the right position when the update page returns. The RadAjaxPanel let us do that and the Javascript would get executed. The Microsoft UpdatePanel just ignores it.
I've tried calling a Javascript function within the RadContextMenu's OnClientLoad to show the menu, but that results in yet another error. It breaks within the Telerik Javascript on something to do with the slide animation of displaying the menu. I tried setting the animation to "None", but that didn't resolve it. I suspect the real problem in this case is that menu isn't fully loaded yet, and I'm tyring to call showAt within the load event.
So my question is.... Is there a workaround to the first problem? If not, is there an alternative solution to the second problem?
Building the context menu using a web service would be ideal, but I pursued that as documented in another thread and never got it to work. I know that behavior wasn't officially supported anyway. Even still, I've lost a week of work trying to get this problem fixed.
Any help would be appreciated.
Thanks,
Terry