'文件名:QueryDepositPrint.aspx.vb
Imports System.Data
Partial Class QueryManage_QueryDepositPrint
Inherits System.Web.UI.Page
Private MyQueryDepositForm As QueryManage_QueryDepositForm
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'将查询结果输出到Excel文件中
MyQueryDepositForm = Context.Handler
Dim MyTable As DataTable = MyQueryDepositForm.MyPrintTable
Dim My截止日期 As String = MyQueryDepositForm.MyPrint截止日期
Me.Label1.Text = Session("MyCompanyName").ToString() + "在店旅客押金费用统计表"
Me.Label2.Text = "截止日期:" + My截止日期
Me.DataGrid1.DataSource = MyTable
Me.DataGrid1.DataBind()
Me.Response.ContentType = "application/vnd.ms-excel"
Me.Response.Charset = ""
'关闭 ViewState
Me.EnableViewState = False
Dim MyWriter As System.IO.StringWriter
Dim MyWeb As System.Web.UI.HtmlTextWriter
'将信息写入字符串
MyWriter = New System.IO.StringWriter()
'在Web窗体页上写出一系列连续的HTML特定字符和文本
MyWeb = New System.Web.UI.HtmlTextWriter(MyWriter)
'将DataGrid中的内容输出到HtmlTextWriter对象中
Me.DataGrid1.RenderControl(MyWeb)
'把HTML写回浏览器
Response.Write(MyWriter.ToString())
End Sub
End Class