I have a VS 2015 ASPX VB project and all is both hunky and dory, when I run in development mode
When I deplpoy the ASPX and ASPX.VB, no bin folder for prod, files to my production server, I a getting the following error.
BC30451: Name 'blnExportData' is not declared.
Can anyone help a newbie out?
Code is as follows
========================
Default.aspx.vb
=======================
Partial Public Class _Default
Inherits System.Web.UI.Page
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
Return
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.cmdExport.Visible = False
End Sub
Sub cmdSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Me.BindGrid()
Me.cmdExport.Visible = True
End Sub
Public Sub BindGrid()
Dim strConnString As String = ConfigurationManager.ConnectionStrings("myConnectionString").ConnectionString
Dim myConnection As New SqlConnection(strConnString)
Dim myCommand As New SqlCommand()
Dim WriteItem As System.IO.StringWriter = New System.IO.StringWriter()
Dim htmlText As System.Web.UI.HtmlTextWriter = New HtmlTextWriter(WriteItem)
myCommand.CommandType = CommandType.StoredProcedure
myCommand.CommandText = "sp_OrderHistory"
myCommand.Parameters.Add("@Company", SqlDbType.VarChar).Value = Me.lstCompany.Text
myCommand.Parameters.Add("@StartDate", SqlDbType.VarChar).Value = Me.txtStartDate.Text
myCommand.Parameters.Add("@EndDate", SqlDbType.VarChar).Value = Me.txtEndDate.Text
myCommand.Parameters.Add("@Product", SqlDbType.VarChar).Value = Me.txtProduct.Text
myCommand.Connection = myConnection
myConnection.Open()
myGridControl.EmptyDataText = "No Records Found"
myGridControl.DataSource = myCommand.ExecuteReader()
If blnExportData = True Then
Response.Clear()
Response.AddHeader("content-disposition", "attachment; filename=ExportResults.xls")
Response.ContentType = "application/vnd.xls"
myGridControl.AllowPaging = False
End If
myGridControl.DataBind()
If blnExportData = True Then
myGridControl.RenderControl(htmlText)
Response.Write(WriteItem.ToString())
Me.cmdExport.Visible = False
blnExportData = False
Response.End()
End If
myConnection.Close()
myConnection.Dispose()
End Sub
Sub cmdExport_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdExport.Click
blnExportData = True
Me.BindGrid()
End Sub
End Class
=============================
Global.asax.vb
=============================
Imports System.Web.SessionState
Public Module DefineGlobals
Public blnExportData As Boolean = False
End Module
Public Class GlobalStuff
Inherits System.Web.HttpApplication
End Class
What I have tried:
It runs fine using iisexpress and vs 2015. Not in prod, using IIS and no bin folder.