Hi Matt,
Thanks for the reply... Don't think what you suggested for me will work as I
need to do other things like load and unload controls!
The Button is in a user control and the idea is that when the person clicks
the upload button it loads a new user control in that shows a progess bar
until the upload is finished at which point it loads another user control in
to say upload complete...
See code below...
' user submitted file to be uploaded
' create URL with query string to confirm file upload
' next page will not be a postback, so viewstate will be lost
Dim sRefreshURL As String = Request.Url.ToString() &
"?Upload=True"
If Request.Browser.Browser = "IE" Then
phBody.Controls.Clear()
phBody.Controls.Add(New LiteralControl("<body onload=" &
Chr(34) & "loadTarget(" & Chr(39) & sRefreshURL & Chr(39) & ")" & Chr(59) &
Chr(34) & " bottomMargin=" & Chr(34) & "0" & Chr(34) & " leftMargin=" &
Chr(34) & "0" & Chr(34) & " topMargin=" & Chr(34) & "0" & Chr(34) & "
rightMargin=" & Chr(34) & "0" & Chr(34) & " runat=" & Chr(34) & "server" &
Chr(34) & ">"))
' set META REFRESH as well in case script is disabled
' use long delay so that script can load page first if
possible
phRefresh.Controls.Clear()
phRefresh.Controls.Add(New LiteralControl("<meta
http-equiv=" & Chr(34) & "refresh" & Chr(34) & " content=" & Chr(34) &
"30;url=" & sRefreshURL & Chr(34) & ">"))
Else
' not IE so use META REFRESH to start loading next page
' allow 3 seconds for progress bar image to load
phRefresh.Controls.Clear()
phRefresh.Controls.Add(New LiteralControl("<meta
http-equiv=" & Chr(34) & "Refresh" & Chr(34) & " content=" & Chr(34) &
"3;url=" & sRefreshURL & Chr(34) & ">"))
End If
' hide Upload file controls and show "wait" section
Dim WaitCnt As Control =
LoadControl("../binFileUpload/ProgressCnt.ascx")
phUploader.Controls.Clear()
phResults.Controls.Clear()
phWait.Controls.Add(WaitCnt)
'pnlUploadFile.Visible = False
'pnlWait.Visible = True
'''Problem
Dim objUpload As New UploadCnt
objUpload.UploadData()
Else
' get query string
Dim iUpload As String = Request.QueryString("Upload")
If iUpload = "" Then
'pnlUploadFile.Visible = True
Dim UploadFrmCnt As Control =
LoadControl("../binFileUpload/UploadCnt.ascx")
phWait.Controls.Clear()
phResults.Controls.Clear()
phUploader.Controls.Add(UploadFrmCnt)
Else
phUploader.Controls.Clear()
phWait.Controls.Clear()
Dim ResultsCnt As Control =
LoadControl("../binFileUpload/ResultsCnt.ascx")
phResults.Controls.Add(ResultsCnt)
End If
Dim sRefreshURL As String = Request.Url.ToString() &
"?Upload=False"
"Matt Dockerty" wrote:
Think I can see what you're doing. The Page_Load is a good place for
initialising anything but there are more specialised events for handling
things like button clicks.
Get the web form designer up, double click the button that causes the
postback. Write the code that handles the button click in the empty
procedure Visual Studio creates. That event will only fire when the button
is clicked so no need to check for a postback.
hth,
Matt
"Tim::.." <myatix_at_hotmail.com> wrote in message
news:41**********************************@microsof t.com... Can someone please tell my why I get the following problem when I type the
following piece of code!
How do I get around this???
The idea is that when a user clicks a button on a form it causes a
postback to occur which in turn triggers a sub in a user control...
Error:
Argument not specified for parameter e of Public Sub UploadDate(Sender As
Object, e As System.EventArgs)
If Page.IsPostBack Then
Dim objUpload As New UploadCnt
objUpload.UploadData()
End IF