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.
Markup:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="notification.aspx.vb" Inherits="TelerikPlayground.notification" %>
<!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 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");
$("#NotificationDialog").show();
$('#butPrint').click();
});
</script>
</telerik:RadScriptBlock>
</head>
<body>
<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"/>
</div>
</telerik:RadAjaxPanel>
</form>
</body>
</html>
Codebehind:
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)
Threading.Thread.Sleep(3000)
Dim ms As New MemoryStream(File.ReadAllBytes("c:\temp\jotch.pdf"))
Response.Expires = 0
Response.Buffer = True
Response.ClearContent()
Response.AddHeader("content-disposition", "inline; filename=" + "jotch.pdf")
Response.ContentType = "application/pdf"
Response.BinaryWrite(ms.ToArray())
ms.Close()
Response.End()
End Sub
End Class
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.
Markup:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="notification.aspx.vb" Inherits="TelerikPlayground.notification" %>
<!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 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");
$("#NotificationDialog").show();
$('#butPrint').click();
});
</script>
</telerik:RadScriptBlock>
</head>
<body>
<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"/>
</div>
</telerik:RadAjaxPanel>
</form>
</body>
</html>
Codebehind:
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)
Threading.Thread.Sleep(3000)
Dim ms As New MemoryStream(File.ReadAllBytes("c:\temp\jotch.pdf"))
Response.Expires = 0
Response.Buffer = True
Response.ClearContent()
Response.AddHeader("content-disposition", "inline; filename=" + "jotch.pdf")
Response.ContentType = "application/pdf"
Response.BinaryWrite(ms.ToArray())
ms.Close()
Response.End()
End Sub
End Class