473,387 Members | 1,485 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 2556
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....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.