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

[Solved] RadAjaxManager & dynamic controls

1 Answer 278 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 13 Apr 2008, 10:47 AM
Hi there,
I am trying to add a few buttons on my page
Here is code behind of Page_Load event:
(default.aspx.cs)
for (int i = 0; i < totalPages; i++)  
{  
     LinkButton b = new LinkButton();  
     b.Text = // never mind  
     b.CssClass = //never mind  
     b.ID = "spb" + i;  
 
     Panel1.Controls.Add(b);  
     RadAjaxManager1.AjaxSettings.AddAjaxSetting(b, RadAjaxPanel1, RadAjaxLoadingPanel1);  
Also in code behind i have the AjaxRequest event handler. This handler updates contents of the RadAjaxPanel1. Running this simple project produce the following code in HTML(please, pay attention to the third argument, it's a _asyncPostBackControlIDs collection of the PageRequestManager):
Sys.WebForms.PageRequestManager.getInstance()._updateControls['tRadAjaxPanel1Panel','tRadAjaxManager1SU'], ['spb0'], [], 90) 
It's obvious that on the current page only 'spb0' control is 'ajaxified'.
Clicking on the LinkButton 'spb0' will proof that statement.
Clicking on the other LinkButtons will generate default postbacks.
Trying to make a little trick with the PageRequestManager i put this code in my default.aspx(at the very end of this file):
<script type="text/javascript">  
        Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tRadAjaxPanel1Panel','tRadAjaxManager1SU'], ['spb0','spb1',...,'spbx'], [], 90);  
</script> 
This code will force all LinkButtons to generate Ajax requests, but unfortunately in code behind only first control 'spb0' generate true AjaxRequest event and return real content of RadAjaxPanel1. All other requests generates no content.
Tracing down all responses i found the following statement in response body:
asyncPostBackControlIDs||spb0| 
So, only the first control created in code behind is able to generate ajax requests...
Simple web project with a controls added to the default page from the toolbox works fine....
Please show where i'm wrong?

1 Answer, 1 is accepted

Sort by
0
Pavel
Telerik team
answered on 16 Apr 2008, 07:16 AM
Hello Andrew,

It is not a good idea to use both RadAjaxManager and RadAjaxPanel to update a control. Please try using only RadAjaxManager and let me know if further assistance is needed.

Best wishes,
Pavel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Ajax
Asked by
Andrew
Top achievements
Rank 1
Answers by
Pavel
Telerik team
Share this question
or