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

[Solved] RadAjaxPanel & RegisterArrayDeclaration

6 Answers 251 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
SteveChadbourne
Top achievements
Rank 1
SteveChadbourne asked on 23 Sep 2007, 11:29 PM
Hi

I have just installed the latest trial (2007_2_918). I get a lot more controls on my toolbar under Prometheus including RadAjaxManager and RadAjaxPanel. Are these now in Promethius or have you included the ASP.Net RadControls in here?

My main problem is with RegisterArrayDeclaration. I use this to provide 2 arrays client side for use with the slider.

Before trying Ajax I used Page.ClientScriptManager.

When I moved to Ajax and used the Ajax UpdatePanel I had to use ScriptManager. All worked fine.

Now I am replacing the UpdatePanel with RadAjaxPanel.

The first time I perform an Ajax update my arrays work fine. If I change a parameter and re-submit my query, my arrays still contain the old values.

I use:

ScriptManager.GetCurrent(this).RegisterDispose(ScaleImageTop, "PremiumArray = undefined; SumAssuredArray = undefined;");


To clear the arrays.

Are ScriptManager and RadAjaxPanel compatible? Any idea why my arrays have stopped updating when I switched from UpdatePanel to RadAjaxpanel?

Cheers

Steve

6 Answers, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 24 Sep 2007, 02:03 PM
Hello Steve,

RadAjaxManager and RadAjaxPanel Prometheus have been added to the suite a few months ago and they are based on the ASP.NET AJAX Framework. Unfortunately due to the specifics of their implementation they cannot support the RegisterDispose(...) method of the ScriptManager control. We would suggest you to use the Sys.IDisposable interface for your client object instead that provides a common interface for the application-defined tasks of closing, releasing, or resetting resources held by instances of a registered Microsoft AJAX Library class.


Kind regards,
Manuel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
SteveChadbourne
Top achievements
Rank 1
answered on 24 Sep 2007, 09:03 PM
Thanks.

Can anyone explain how to do this? I don't know how to create a client side array using IDisposable.

Currently I loop through a list and add each member to the array like this:

for (int i = 0; i < quoteList.Count; i++)

{

ScriptManager.RegisterArrayDeclaration(this, "PremiumArray", string.Format("\"{0}\"", quoteList[i].Premium));

ScriptManager.RegisterArrayDeclaration(this, "SumAssuredArray", string.Format("{0}", quoteList[i].SumAssured));

}

My old ClientScriptManager based array used to ovewrite, but my new ScriptManager based array does not so I have to clear it each time.

If I can't use RegisterDispose to do this how do I implement IDisposable and where then do I call it to reset the array?

Cheers

Steve

0
Giuseppe
Telerik team
answered on 25 Sep 2007, 11:17 AM
Hello Steve,

We suggested implementing IDisposable in a client type of yours as its dispose( ) method provides a common interface for the application-defined tasks of closing, releasing, or resetting resources i.e. as a replacement of the RegisterDispose method (and not for creating new resources e.g. arrays).

Alternatively you can use the RadAjaxPanel.ResponseScripts property to register scripts manually that would perform the clearing operation like this: RadAjaxPanel1.ResponseScripts.Add("PremiumArray = undefined; SumArray = undefined;");
 

Kind regards,
Manuel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Developer
Top achievements
Rank 1
answered on 07 Mar 2008, 06:29 PM
I'm having exactly the same problem this person has, and it goes beyond not being able to clear the array.  The array is not being updated AT ALL when using the RadAjaxPanel, even though the code works fine under a normal ajax update panel.

Also, in general it is pretty limiting that you can't implement the script manager's register dispose methodology.  In my case, the one on the update panel would work, but tying this to a specific update panel would not in most cases.

So far I have not been impressed with Promethius as a whole.  Its EXTREMELY buggy, even for a beta and seems to limit your AJAX functionality in many cases.  This product needs a LOT of improvement before I would even consider using it in a production environment.
0
Mangesh
Top achievements
Rank 1
answered on 29 Jun 2009, 06:52 AM
HI,
I  am also facing the above issue. The last post is more than year back so I hope there is solution for it now.
I am using RadScriptManager and RadAjaxManager combination for my page. My RadControls are inside a grid in which user can input his data. I am creating array of all the control IDs  and passing it to client side using ClientScriptManager.RegisterArrayDeclaration for my custom validations and other operations using javascripts. There is a functionality in my grid that when user hits tab in the last row, a new row gets added in the grid. I need all control IDs on the client side but the array formed contains only IDs of the controls which are at the time of pageload. e.g.: If I have 2 rows in the grid by default when the page loads, the array contains two ids, but when a new row gets added in the grid, the array don;t get updated with the third id. I am doing ClientScriptManager.RegisterArrayDeclaration in prerender event of my grid. When I debugged the code, I found that I get the new ID in that event and array gets formed correctly but array created with ClientScriptManager.RegisterArrayDeclaration doesn't get updated with these new values.
      One thing I observed is, if I do EnablePartialRendering="false" in RadScriptManager, the IDs get updated (Doesn't contain ID of the newly added control though) but page throws "PageRequestManagerException...it is not null or object" . e.g.: If I have 2 rows by default and I add third row, array have IDs of two controls but when I add fourth row, array gets updated with the third ID.
Does this clue help in any way? Please let me know if you need any more information.
Please let me know if there is any update regarding this.

Thanks,
Mangesh

0
Sebastian
Telerik team
answered on 30 Jun 2009, 08:19 AM
Hello Mangesh,

Thank you for the detailed explanation.

Can you please check whether using the ScriptManager.RegisterArrayDeclaration static method instead of ClientScriptManager.RegisterArrayDeclaration addresses the issue you are currently facing? With partial rendering enabled, it is recommended to use the static methods of the ScriptManager class to register your client scripts/arrays on the page.

Another thing you can try is replace temporary the RadScriptManager control with regular MS ScriptManager to see whether this produces a different result.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Ajax
Asked by
SteveChadbourne
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
SteveChadbourne
Top achievements
Rank 1
Developer
Top achievements
Rank 1
Mangesh
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or