2015-08-27 99 views
-1

我有一個公共只讀屬性BatchInvoice作爲字符串,我在使用PreviousPage在下一頁上讀取。我設置的其他屬性工作正常。只是這一個字符串不返回任何東西。Public PreviousOnly屬性從PreviousPage返回'nothing'

這是我的代碼。

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 

什麼可能我錯過了什麼?

在此先感謝! Joel

+0

WebForms? MVC?添加適當的標籤到你的問題。 –

+1

PreviousPage從哪裏來? –

+0

Hi @Sam。這是一種MVCish方法。它使用JSRender的webforms。 – Joel

回答

0

我爲此道歉。

出於任何原因,在AsyncFileUploader UploadedComplete事件之後,我在前一頁上設置的public readonly屬性將被清除。我更換了控制器,現在它正在工作。謝謝!

Joel