472,378 Members | 1,299 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,378 software developers and data experts.

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 2491
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Stephen | last post by:
I have the following code working in order to create an array list and populate a datagrid however everytime i click my button the first item in the array and the first row in the datagrid are...
2
by: Jay Walker | last post by:
I created a custom DataGridColumn based on Marcie Robillard's MSDN Article: Creating Custom Columns for the ASP.NET Datagrid...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
6
by: Olivier Matrot | last post by:
Hello, This has probably been asked several times, but It must be clarified for me. I would like to know why sometimes during a postback Page_Load is called after the function marked for...
0
by: Managed Code | last post by:
Hello All, Here is my issue and thanks in advance for any assistance. I have a base page with a dropdownlist that fires an event with the selected index. The content page catches the event and...
7
by: Tim_Mac | last post by:
hi, using .net 2.0, i have a web form with lots of textboxes, drop-down-lists etc. There are lots of required field validators and regular expression validators. When i click the 'save' button,...
11
by: antonyliu2002 | last post by:
I know that this has been asked and answered thousands of times. As a matter of fact, I know that I need to say If Not Page.IsPostBack Then 'Do something End If for things that needs to be...
2
by: Paul | last post by:
I've written som junk code below to show a problem I'm getting: On a page I've got a dropdownlist and a button using submit behaviour: <asp:DropDownList ID="tester" runat="server"...
2
by: Oriane | last post by:
Hello there, I use an Ajax slider extender and I'm try to find a workaround to a known (http://forums.asp.net/p/1092702/2681110.aspx) "bug" of the slider control from the Ajax Control Toolkit....
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.