469,282 Members | 1,914 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

Postback/ EventArgs Problem...

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
Nov 19 '05 #1
3 2345
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

Nov 19 '05 #2
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


Nov 19 '05 #3
Hi Tim,

I think the actal problem is simply that you have UploadData defined
somewhere with a different signature (an event handler signature).

I really don't see how this code is going to work even if that does get
fixed though. There probably are hacks you could use to show activity as a
file is uploaded (using javascript, frames and such) but in this case your
progress page will not be sent back to the browser until the upload is
actually finished.

Good luck, hope you work it out.

Best,
Matt

"Tim::.." <myatix_at_hotmail.com> wrote in message
news:2C**********************************@microsof t.com...
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


Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Stephen | last post: by
6 posts views Thread by Olivier Matrot | last post: by
7 posts views Thread by Tim_Mac | last post: by
11 posts views Thread by antonyliu2002 | last post: by
2 posts views Thread by Paul | last post: by
2 posts views Thread by Oriane | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.