来自PreviousPage的Public ReadOnly属性返回' nothing'

时间:2015-08-27 06:31:18

标签: vb.net webforms jsrender

我有一个公共只读属性BatchInvoice as String,我在下一页上使用PreviousPage阅读。我设置的其他属性工作正常。只是这一个没有返回的字符串。

这是我的代码。

Private _sBatchInvoice As String

Public ReadOnly Property BatchInvoice As String
    Get
        Return _sBatchInvoice
    End Get
End Property

_sBatchInvoice is populated from an AsyncFileUploadEventArgs.

Protected Sub BatchUploader_UploadedComplete(sender As Object, e As AjaxControlToolkit.AsyncFileUploadEventArgs)
    Dim sArrayList As String()

    With class1
        If uplBatchFile.HasFile Then
            System.Threading.Thread.Sleep(500)

            Dim savePath As String = MapPath(IO.Path.Combine("~/Temp", System.IO.Path.GetFileName(uplBatchFile.FileName)))
            uplBatchFile.SaveAs(savePath)
            sArrayList = .GetBatchUpload(uplBatchFile.FileName)
            Dim i As Integer

            For i = 0 To sArrayList.Length - 1
                _sBatchInvoice = _sBatchInvoice & "'" & sArrayList(i).ToString() & "',"
            Next

            'remove last comma
            _sBatchInvoice = _sBatchInvoice.TrimEnd(CChar(","))
        End If
    End With


End Sub

在下一页上,我通过以下方式访问BatchInvoice:

Public sInvoiceList as String

With PreviousPage  
sInvoiceList = .BatchInvoice '-- this returns 'Nothing'  
End With

我错过了什么?

提前谢谢! 乔尔

1 个答案:

答案 0 :(得分:0)

我为此道歉。

出于任何原因,我在上一页设置的public readonly属性在AsyncFileUploader UploadedComplete事件之后被清除。我更换了控件,它现在正在工作。谢谢!

乔尔