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

RadDoc looses CSS style changes after Ajax call

1 Answer 50 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Steven Berndt
Top achievements
Rank 1
Steven Berndt asked on 12 May 2010, 11:08 PM
I'm using a RadDoc which contains titlebar commands that trigger clientside javascript.  This javascript uses jquery to increase and decrease the font sizes of the objects the RadDoc contains.  The following sample increases the font size of the "a" and "span" elements.

function IncreaseFontSize(dock, args) {
    var _contentId = new String(dock.get_handle().id);
    _contentId = _contentId.substr(0, _contentId.length - 1) + "C";
    var currFontSize = $("#" + _contentId).css('fontSize');
    var _currentFontSize = parseFloat(currFontSize, 10);
    _currentFontSize *= 1.15;
    $("#" + _contentId).css('fontSize', _currentFontSize + "px");
    $("#" + _contentId + " a").css('fontSize', _currentFontSize + "px");
    $("#" + _contentId + " span").css('fontSize', _currentFontSize + "px");
    etc...
}

This works great, however when I trigger an ajax call that updates the RadDoc, the objects reset back to their original font size.  Even clicking on a RadGrid column header trigger the font reset. Any ideas how I can retain all font size changes?  Is there an event I could tap into once the ajax call completes? If so, maybe I could use this event to change the fonts to the desired size.  Thanks in advance for your help.











1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 13 May 2010, 07:28 AM
Hi Steven,

AJAX requests replace the HTML output of the updated control(s) with fresh output from the server. The server does not know about your client-side font-size customizations, that's why the observed behavior is expected. You can use the OnResposeEnd client event of RadAjaxManager (or RadAjaxPanel) to set the font-size back to the desired value.

http://www.telerik.com/help/aspnet-ajax/ajxonresponseend.html

Best wishes,
Dimo
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Ajax
Asked by
Steven Berndt
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or