Author: ADH | Posted on: 2/9/2010 4:29:11 AM | Views : 249

I have 5 FileUpload controls on a page (fileUpload1, fileUpload2 etc), and I want to loop through them and upload what they contain. Ideally like so:
 
Sub btnUpload(...)
   Dim myFileUpload As FileUpload
   For x As Integer = 1 To 5
      myFileUpload = Me.FindControls("fileUpload" & x)
      ... 'Do upload with myFileUpload here
   Next x
End Sub
 
However, I'm getting a NullReferenceException error on the myFileUpload = Me.FindControls("fileUpload" & x) line.
Any suggestions?
Thanks!
...

Go to the complete details ...