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

WebResource not injected in page after full then partial postback

8 Answers 198 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ben Amada
Top achievements
Rank 1
Ben Amada asked on 01 Apr 2010, 01:01 PM
Hi.  I'm using an AjaxPanel for async postbacks.  Within that, I have a Rad File Upload control.  For file uploads, I turn off Ajax via set_enableAjax(false).  The file upload works correctly -- a full postback occurs.

After the full postback, if I then make some async postbacks within that AjaxPanel (which hides and unhides controls), when the Rad File Upload control becomes visible again, the styling for the Rad File Upload has disappeared.

I can see in Firebug that the first time the File Upload control appears, there are about 6 <link> tags in the <head> section for Telerik WebResource files.  When the styling is missing for the File Upload control, there is only about 1 WebResource <link> tag in the <head> section.  These missing WebResource files are causing the styling issues.

If I never upload a file (meaning there is no full postback), and I do several ajax postbacks, each time the File Upload control appears again, it is styled correctly everytime.  So it's only after a full postback, and then when I make a subsequent partial postback to make the File Upload control appear again, is this problem occurring.

I'm using Q1 2010.  Same problem is occurring in IE and Firefox.  I'm not seeing any errors in the Firefox Error Console.  I think this is a problem on the server side code not injecting the WebResource files in this scenario.  Any help is appeciated -- thanks.

8 Answers, 1 is accepted

Sort by
0
Ben Amada
Top achievements
Rank 1
answered on 02 Apr 2010, 02:30 AM
I created a small test page that demonstrates this problem.

While creating this, I noticed that the problem only occurs when making the PlaceHolder containing the Upload control invisible when the "Upload" button is clicked.  I made a note of this in the "Upload" server side button handler code.

To reproduce the problem,
(a) Load the page
(b) Select a file to Upload
(c) Click the Upload button (the placeholder will be made invisible)
(d) Click the "Toggle Upload control Visibility" button to make the Upload control visible again

At this point, styling will be gone for the Upload control.  You'll actually see some strange CSS effects too when hovering your mouse over the Upload control.  This is because the WebResource.axd files are not getting loaded.

I hope someone at Telerik can look at this.  Thanks in advance.

<%@ Page Language="C#" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<script runat="server"
 
    protected void ToggleUploadControlVisibility(object sender, EventArgs e) 
    { 
        phUpload.Visible = !phUpload.Visible; 
    } 
 
    protected void Upload(object sender, EventArgs e) 
    {  
        // process upload 
         
        // NOTE: If you comment out the line below, the problem does NOT occur. 
        // 
        // If you leave the line below, the next time you click the button to make 
        // the File Upload control visible, styling for the upload control will 
        // be missing.  The WebResource.axd files do not load. 
         
        phUpload.Visible = false
    } 
     
</script> 
 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title></title
     
    <script type="text/javascript"
 
        function OnRequestStart(target, arguments) { 
            if (arguments.get_eventTarget().indexOf("btnUpload") != -1) { 
                arguments.set_enableAjax(false); 
            } 
        } 
     
    </script> 
</head> 
<body> 
    <form id="form1" runat="server"
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnablePageMethods="true"
        <Scripts> 
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" /> 
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" /> 
        </Scripts> 
    </telerik:RadScriptManager> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
    </telerik:RadAjaxManager> 
    <telerik:RadSkinManager ID="RadSkinManager1" Runat="server" Skin="Default"
    </telerik:RadSkinManager> 
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" /> 
     
    <div> 
     
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1" ClientEvents-OnRequestStart="OnRequestStart"
         
            <asp:Button ID="btnToggleUploadVisibility" runat="server" OnClick="ToggleUploadControlVisibility" Text="Toggle Upload control Visibility" /> 
            <br /><br /> 
         
            <asp:PlaceHolder ID="phUpload" runat="server"
                <telerik:RadUpload ID="radUpload" runat="server"></telerik:RadUpload> 
                <asp:Button ID="btnUpload" runat="server" OnClick="Upload" Text="Upload" /> 
            </asp:PlaceHolder> 
         
        </telerik:RadAjaxPanel> 
     
    </div> 
    </form> 
</body> 
</html> 
 

0
Genady Sergeev
Telerik team
answered on 05 Apr 2010, 03:37 PM
Hi Ben Amada,

Indeed such problem exists. We will try to get it fixed for future releases of the control suite. Meanwhile you can:

1) Manually register the CSS files using <link tags>
2) Or  add hidden upload to your page so that the correct CSS styles are always loaded. Here is sample markup:

<form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnablePageMethods="true">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <telerik:RadSkinManager ID="RadSkinManager1" Runat="server" Skin="Default">
    </telerik:RadSkinManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
      
    <div>
     
        <telerik:RadUpload runat="server" ID="RadUpload1" style="display:none;"></telerik:RadUpload>
 
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1" ClientEvents-OnRequestStart="OnRequestStart">
          
            <asp:Button ID="btnToggleUploadVisibility" runat="server" OnClick="ToggleUploadControlVisibility" Text="Toggle Upload control Visibility" />
            <br /><br />
          
            <asp:PlaceHolder ID="phUpload" runat="server">
                <telerik:RadUpload ID="radUpload" runat="server"></telerik:RadUpload>
                <asp:Button ID="btnUpload" runat="server" OnClick="Upload" Text="Upload" />
            </asp:PlaceHolder>
             
        </telerik:RadAjaxPanel>
      
    </div>
    </form>

Meanwhile I will dig more into this issue and will write a follow up to you by tomorrow If I manage to find another, more convinient workaround.

Greetings,
Genady Sergeev
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.
0
Ben Amada
Top achievements
Rank 1
answered on 06 Apr 2010, 07:36 AM
Hi Genady,

Thanks for taking a look and offering workarounds.  I'm using the hidden FileInput you suggested and it has solved the problem.  Hopefully this will be more permanently fixed in a near release, but I'm happy for now.

Thanks -- Ben
0
meidianto
Top achievements
Rank 1
answered on 07 Aug 2010, 04:26 AM
I have similar case, but in my case I lost the CSS or RadDatePicker.
That adding hidden control trick also works for me.
I added a hidden RadDatePicker and the issue gone.
0
Madhu
Top achievements
Rank 1
answered on 12 Jun 2013, 10:08 PM
Hi

I am using the latest version of telerik and I am facing this issue.. Is this not fixed yet?
0
Hristo
Top achievements
Rank 1
answered on 13 Jun 2013, 02:32 PM
Hi,

Try to add RadStyleSheetManager on the page. It should resolve the issue.
0
Alfred
Top achievements
Rank 1
answered on 20 Jun 2013, 01:41 PM
I added an empty RadStyleSheetManager and all my Rad Controls lost all their Styles.
0
Hristo Valyavicharski
Telerik team
answered on 25 Jun 2013, 08:04 AM
Hi Alfred,

Are you using custom skin? Please create a new support ticket and attach sample project, so we can troubleshoot it locally for you.

Thanks.

Regards,
Hristo Valyavicharski
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
General Discussions
Asked by
Ben Amada
Top achievements
Rank 1
Answers by
Ben Amada
Top achievements
Rank 1
Genady Sergeev
Telerik team
meidianto
Top achievements
Rank 1
Madhu
Top achievements
Rank 1
Hristo
Top achievements
Rank 1
Alfred
Top achievements
Rank 1
Hristo Valyavicharski
Telerik team
Share this question
or