【发布时间】:2015-08-27 06:31:18
【问题描述】:
我有一个公共只读属性 BatchInvoice 作为字符串,我在下一页使用 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
我可能错过了什么?
提前致谢! 乔尔
【问题讨论】:
-
网络表单? MVC?为您的问题添加适当的标签。
-
PreviousPage 来自哪里?
-
嗨@Sam。这是一种 MVCish 方法。它使用带有 JSRender 的网络表单。
-
嗨@Matt,代码的第一部分来自上一页。当我从当前页面的上一页访问属性 BatchInvoice 时,它什么也不返回。希望我正确回答了您的问题。
-
PreviousPage是什么Object,在哪里设置?如果您使用 WebForms,我怀疑您的
_sBatchInvoice变量在回发时会被清除,但如果没有更多代码,很难猜测