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

PersistStateInCookie and redirect

8 Answers 99 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
CSurieux
Top achievements
Rank 2
CSurieux asked on 04 Dec 2008, 11:42 AM
Hello,

I am using sucessfully PersistStateInCookie between pages of my site but in some special cases the response is redirected in code behind and I get a page with my old page-item selected in PanelBar.
I have seen the code library on this point but I am not satisfyed with solutions of adding something in query string (already heavilly loaded).
Cookie seems top be the best approach but I need to be able to fix it before my response.redirect, how to do this ?
Is there some internal API I could use, deriving a class from PanelBar and calling it with the new item I want to select ?

Thanks for help...again.

CS

8 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 04 Dec 2008, 02:06 PM
Hi Christian Surieux,

Unfortunately there is no API which you can use to tweak the cookie value on the server side. Using query string arguments seems to be the only workaround for the time being.

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
CSurieux
Top achievements
Rank 2
answered on 04 Dec 2008, 02:51 PM
Alber,

Thanks for answer, but it is no helpfull in my case.
So changing selected item before redirect gives no opportunity changing the cookie serverside, what a pity :)
Hope that this is on the todo list for panelbar, it seems easy to implement when using the cookie, but I don't want to do it by myself as I have seen that the cookie format has already been changed in the past.

I have another problem: in an ajaxifyed (RadAjaxaManager) button click, I must rebuild all my panelBar content, and, as it is not a binding but a 'manual' adding of items, I need a way to reset all the content already installed in Onload. I tryed Items.clear() but I get problems: the radPanel get inactive after callback ?
Ajax seems to work because other controls implied in the ajax call are correctly set, only radpanel get destroyed.
I think it is my reset using item.clear which is not perfect, should I call any other api before rebuilding the radPanel ?

CS
0
Atanas Korchev
Telerik team
answered on 04 Dec 2008, 03:09 PM
Hi Christian Surieux,

The Clear method of the Items collection is the official way of clearing panel items. What do you mean by saying the the panelbar is inactive after Ajax? Are there any JavaScript errors?

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
CSurieux
Top achievements
Rank 2
answered on 04 Dec 2008, 03:36 PM
No javascript error but I have to investigate further in my code, could you confirm that PanelBar could used as  the updated control in an ajaxsetting added in codebehind during OnPrerender ?

Thanks
CS
0
Atanas Korchev
Telerik team
answered on 04 Dec 2008, 03:38 PM
Hi Christian,

Yes, I confirm. Please open a support ticket and send us your project in case you are not able to resolve the problem by yourself.

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
CSurieux
Top achievements
Rank 2
answered on 04 Dec 2008, 05:52 PM
Hello Albert,

Error was in my javascript.
Could you confirm that after an ajax callback, the document elements which correspond to controls to be updated are destroyed and recreated ?
Seems to be the reason causing my problem: before the ajax call, I attach an handler to onclick on an image object found with $get, so if  the image object is recreated after ajax call, it looses its on click handler ?

One last question, what happens to the replaced elements ?
To be more explicit, I attached a Telerik.Web.UI.Slide object to an element which is replaced after call back: what happen to this Slide object, is it still present in browser memory ? How to clean it ?

And what if the javascript was using objects refreshed and object not refreshed, all part of a same composite control ?
How to be sure that the javascript for this control is correctly reloaded as only one part of the composite is refreshed ?

This became a question more AjaxManager oriented ...

Thanks for answer.
CS
0
Atanas Korchev
Telerik team
answered on 04 Dec 2008, 05:56 PM
Hello Christian Surieux,

The question is actually ASP.NET Ajax oriented :) Anyway - indeed after ajax updates all affected elements are destroyed. You need to reattach all event handlers after the ajax update finishes. You can use the endRequest client-side event to do that.

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
CSurieux
Top achievements
Rank 2
answered on 04 Dec 2008, 06:03 PM
Yes ASP.NET Ajax is just a little ...heavy baby :)
I will give a look to enrequest, thanks.

CS
Tags
PanelBar
Asked by
CSurieux
Top achievements
Rank 2
Answers by
Atanas Korchev
Telerik team
CSurieux
Top achievements
Rank 2
Share this question
or