asked on
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" title="Untitled Page" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<script language="javascript" type="text/javascript">
function NoProcessesAlreadyRunning()
{
var isBusy = "1";
if (isBusy == 1)
{
alert("Currently Processing Report");
return false;
}
else
{
isBusy = "1";
return true;
}
}
</script>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Panel ID="pnl2Export" runat="server">
<asp:Table ID="Table1" runat="server">
<asp:TableRow>
<asp:TableCell>
This will Print if this is successful!
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</asp:Panel>
<asp:Button ID="Postback" runat="server" Text="Export Control (panel)" OnClick="Postback_Click" OnClientClick=""/>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="Postback" />
</Triggers>
</asp:UpdatePanel>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:HiddenField ID="hfBusyProcessing" runat="server" />
</asp:Content>
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Postback_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Try
' excel export
Response.Clear()
Response.AddHeader("content-disposition", "attachment;filename=ExcelReport.xls")
Response.Charset = ""
'Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls"
Dim stringWrite As New System.IO.StringWriter()
Dim htmlWrite As System.Web.UI.HtmlTextWriter = New HtmlTextWriter(stringWrite)
pnl2Export.RenderControl(htmlWrite)
Response.Write(stringWrite.ToString())
Response.[End]()
hfBusyProcessing.Value = "0"
Label1.Text = "Updated" 'this portion does not execute correctly and the label1.text = ""
Catch ex As Threading.ThreadAbortException
Label1.Text = "Updated"
Catch ex As Exception
End Try
Label1.Text = "Updated"
End Sub
End Class
ASKER
ASKER
The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications
TRUSTED BY
Open in new window