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

[Solved] Page.ParseControl loses CSS styles

4 Answers 104 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
QualiWareUA
Top achievements
Rank 1
QualiWareUA asked on 18 May 2009, 02:14 PM
Hello,

We have a problem with Page.ParseControl method. We pass a whole page as a string argument. This page also contains css styles (declarative). The result, which is a Control object is added to the main form. All controls are AJAXified on the form. Everything looks fine on first load. But if, for example, a button is clicked (no matter where it was declared - on the parent form or in "string") a post (AJAX) post-back is performed. After it the styles are lost.

Have anybody come across such a thing?

Best regards,
Vladimir Kovalenko

4 Answers, 1 is accepted

Sort by
0
QualiWareUA
Top achievements
Rank 1
answered on 19 May 2009, 01:53 PM
I have worked it around by placing internal CSS styles inside <body /> instead of <head /> as usual.

This behavior is observed only in IE. This might be some sort of bug. Anybody knows?

Best regards,
Vladimir Kovalenko
0
Dimo
Telerik team
answered on 19 May 2009, 02:20 PM
Hello Vladimir,

I am not sure I understood how the CSS styles are related to the whole scenario and how are they used, but I doubt that there is a problem with the AJAX functionality itself. Can you demonstrate a similar approach to the one that you are using on a standalone web page, which exhibits the unexpected behavior?

Greetings,
Dimo
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.
0
QualiWareUA
Top achievements
Rank 1
answered on 21 May 2009, 11:09 AM
Hi Dimo,

The problem is reproduced when there is AjaxSettings. Not using AJAX does not cause the problem.

I would post a sample project, but there is no way to attach files here...

Anyway, let's assume there is an HTML page like

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml"
<head> 
    <title>Content</title> 
    <!--  
    When Button1 on Default.aspx is clicked, the styles below are discarded. 
    To make it working, it is necessary to move them into <body />
    Note: the problem can be reproduced in IE only. 
     --> 
    <style type="text/css" media="all"
        body 
        { 
            background-color: Maroon; 
        } 
         
        .content  
        { 
            display: block; 
            width: 180px; 
            float: left; 
            font-weight: bold; 
            padding-top:5px; 
            color: Olive; 
        } 
    </style> 
</head> 
<body> 
    <div class="content">Content page!</div> 
</body> 
</html> 
 

and you load this page inside a placeholder. The page is parsed as a string (preliminary read from a file) with the help of Page.ParseControl method. Alongside there is a button next to placeholder. AjaxSettings are set up so that the button updates the placeholder. When you run this form for the first time you will see read background. When you click on the button, it will turn white.

Best regards,
Vladimir Kovalenko
0
Dimo
Telerik team
answered on 25 May 2009, 12:31 PM
Hello Vladimir,

I can't seem to reproduce the problem - see the attached example.

If you need further assisitance, you can attach a sample project in a regular support ticket.

Sincerely yours,
Dimo
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
QualiWareUA
Top achievements
Rank 1
Answers by
QualiWareUA
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or