Click here to Skip to main content
15,893,190 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
=======================

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
=============================
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.
Posted
Updated 25-Mar-17 15:52pm
v2
Comments
Bryian Tan 25-Mar-17 21:53pm    
Why don't you include the bin folder?
yanks_win 28-Mar-17 7:11am    
It is the clients preference. The bin folder would make this easier, I agree.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900