Skin disappears

2 posts, 0 answers
  1. Jonas
    Jonas avatar
    4 posts
    Member since:
    Jan 2013

    Posted 22 Oct 2013 Link to this post

    Hi there,

    I have the following scenario that I need to implement: 
    1. Generate a pdf-file (serverside). This will take me about 10 seconds server-side
    2. Send file to browser

    While the file is generated, I need to display something to the user. I am currently using the Radnotification control for this.

    My problem is:
    While the file is generated the notification control loses its Skin. I have tried different approaches to solve it, but with no luck so far.
    It is important to consider, that the generated pdf-file is sent to the by writing to the Response-object, which is not allowed when the trigger lies within an update panel. 

    I suspect I must be missing some fundamental knowledge of the Telerik controls and hope you can guide me in the right direction. Below is my code.


    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="notification.aspx.vb" Inherits="TelerikPlayground.notification" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

    <html xmlns="">
    <head id="Head1" runat="server">
        <title>Udskriv fakturaer</title>
        <script src="Scripts/jquery-1.6.4.js" type="text/javascript"></script>
        <script src="Scripts/jquery-ui-1.9.2.js" type="text/javascript"></script>
        <telerik:RadScriptBlock ID="scriptBlock" runat="server">
            <script type="text/javascript">

                $(document).ready(function () {
                            $("#beskrivelseAntal").text("Notification text");
        <form id="form1" runat="server">
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
            <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
            <div style="margin-left: auto;margin-right: auto; width: 350px;margin-top:20px;">
            <asp:Button runat="server" ID="butPrint" OnClick="print_click" style="display: none;"/>
                    <telerik:RadNotification ID="NotificationDialog" runat="server" Skin="WebBlue"  EnableRoundedCorners="true" Title="Working" Text="Working" VisibleOnPageLoad="True" Position="Center" ShowCloseButton="False" AutoCloseDelay="0" Width="350" ShowTitleMenu="false"/>

    Imports System.IO

    Public Class notification
        Inherits System.Web.UI.Page

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        End Sub

    Protected Sub print_click(ByVal sender As Object, ByVal e As EventArgs)


        Dim ms As New MemoryStream(File.ReadAllBytes("c:\temp\jotch.pdf"))

          Response.Expires = 0
          Response.Buffer = True
          Response.AddHeader("content-disposition", "inline; filename=" + "jotch.pdf")
          Response.ContentType = "application/pdf"
        End Sub

    End Class

  2. Marin Bratanov
    Marin Bratanov avatar
    4441 posts

    Posted 23 Oct 2013 Link to this post

    Hi Jonas,

    You cannot send files during a partial postback, so I advise that you move the hidden button out of the RadAjaxPanel:
    <asp:Button runat="server" ID="butPrint" OnClick="print_click" Style="display: none;" />
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">

    With your current setup I only get a JavaScript error because the browser cannot parse the received data, which is expected in this case. At this point the notification looked fine on my end, however.

    Also note that you need to use the client-side API of the RadNotification control to show it, i.e. the $find() method, e.g.:

    I am attaching here a short video that demonstrates the proper functionality. Note how it does not use AJAX for the postback that will bring the PDF file to the browser.

    Marin Bratanov
    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.
Back to Top