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

web user control ajax manager proxy help

1 Answer 90 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Nazım
Top achievements
Rank 1
Iron
Nazım asked on 23 Jul 2012, 06:42 AM
I have two page 
PoliklinlList.aspx
Tanilar.ascx

I use Tanilar.ascx web user control in the Polklinik page.
Ajax manager is in the Poliklinik page.
There are two radgrid in web user controls: radTanilar and radSeciliTanilar
I want to add some value from radTanilar  to radSeciliTanilar after adding I want to show it in the page.But radSeciliTanilar  isn't refresh itself although my web user control is in the updatecontrol of ajax settings.

.

I manage to call my ajax manager from web user control like:
function TanilarRowClick(sender, eventArgs) {
            var id = eventArgs.getDataKeyValue("ID");
            document.getElementById("grdTanilarDClickedRowIndex").value = id;
            $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("taniekle");
 
        }

When I click the radTanilar  row, TanilarRowClick event run and myRadAjaxManager1_AjaxRequest which is in the PoliklinlList page is run also.

myRadAjaxManager settings like this:   (ucpTani is the Id of web user controls')
)
<telerik:RadAjaxManager ID="RadAjaxManager1" OnAjaxRequest="RadAjaxManager1_AjaxRequest"
        runat="server">
        <AjaxSettings>               
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="ucpTani" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>    
</telerik:RadAjaxManager>


When I add my controls(radseciliTanilar and radTanilar) which are in web user controls manually on code like this:

RadGrid grdSeciliTanilar = (RadGrid)ucpTani.FindControl("grdSeciliTanilar");
RadAjaxManager1.AjaxSettings.AddAjaxSetting(RadAjaxManager1, grdSeciliTanilar);
RadAjaxManager1.AjaxSettings.AddAjaxSetting(grdTani, grdSeciliTanilar);

 I get error like this:

Server Error in '/' Application.
 
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) +9585723
   Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) +221
 
[HttpException (0x80004005): Please, see whether wrapping the code block, generating the exception, within RadCodeBlock resolves the error.]
   Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) +286
   Telerik.Web.UI.RadAjaxControl.PerformRender() +498
   Telerik.Web.UI.RadAjaxControl.OnPageRender(HtmlTextWriter writer, Control page) +1819
   Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) +155
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +268
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1284

when I add RadAjaxManagerProxy to my user control I get the same error.



1 Answer, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 25 Jul 2012, 08:22 AM
Hello Nazim,

Could you please try wrapping your JavaScript code (no matter whether it is in the head section or not) in RadCodeBlock as depicted in the following article and let me know if the issue still persits:
http://www.telerik.com/help/aspnet-ajax/ajax-radscriptblock-radcodeblock.html

Looking forward for your reply.

Regards,
Radoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Ajax
Asked by
Nazım
Top achievements
Rank 1
Iron
Answers by
Radoslav
Telerik team
Share this question
or