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

Control updated on each AJAX request

5 Answers 75 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
VictorG
Top achievements
Rank 1
VictorG asked on 27 Jan 2009, 04:36 PM

Hi,

I would like to know if it is possible to update a control (status message) on each AJAX request. Setting AjaxSetting would not work because any control on any user control may trigger the postback.
I was thinking of doing this in JavaScript, something like catching the OnRequestStart event and then calling __doPostback for my control but it doesn't seem to work. Do you have any solution for this? 

Thank you
Victor

5 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 28 Jan 2009, 01:35 PM
Hi Victor,

Attached to this message is a small application, aimed at replicating your setup. Please check it and let me know how if it helps.


Best wishes,
Pavlina
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
VictorG
Top achievements
Rank 1
answered on 29 Jan 2009, 10:46 AM
Hi Pavlina,

From your example I understand that the only way to update a control on each postback is to link it in Ajax Settings to all the controls which can trigger a postback.  Isn't there an easier way?
I ask this because I have this control in a master page. Each page in my application would have set this dependency for each control it contains and this is relatively hard to maintain.

Thank you,
Victor
0
Pavlina
Telerik team
answered on 30 Jan 2009, 09:07 AM
Hi Victor,

To link control in Ajax Settings is not the only way to update your status message after a postback.
I've used the ResponseScripts property of the RadAjaxManager and prepared a sample project, which handles the functionality that you mentioned. Look at it and let me know how it goes and if this is the expected behavior.

For more information look at the following link.

All the best,
Pavlina
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
VictorG
Top achievements
Rank 1
answered on 02 Feb 2009, 08:31 AM
Hi Pavlina,

Thank you for your indications. It works as expected except that I had to ecode the string that is sent to the java script function because it fails when the string contains special characters.
See here:

Also, I have used the ResponseScripts command in the overridden RaisePostBackEvent method.

Thank you,
Victor
0
Pavlina
Telerik team
answered on 04 Feb 2009, 07:05 AM
Hi Victor,

There is no other way except to encode the string that is sent to the java script function, as it is explain in the shown blog.

The problem is that using

embedHtml("{0}");

or

embedHtml('{0}');

is a string literal and it has to be embedded into the page properly or else code will blow up sporadically as certain characters are part of the strings embedded.

The fix for this is to encode the string to embed.

Regards,

Pavlina
the Telerik team

 


Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
VictorG
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
VictorG
Top achievements
Rank 1
Share this question
or