473,543 Members | 3,906 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(Send er As
Object, e As System.EventArg s)
If Page.IsPostBack Then
Dim objUpload As New UploadCnt
objUpload.Uploa dData()
End IF
Nov 19 '05 #1
3 2567
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_hotm ail.com> wrote in message
news:41******** *************** ***********@mic rosoft.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(Send er As
Object, e As System.EventArg s)
If Page.IsPostBack Then
Dim objUpload As New UploadCnt
objUpload.Uploa dData()
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.ToS tring() &
"?Upload=Tr ue"

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.Contr ols.Clear()
phRefresh.Contr ols.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.Contr ols.Clear()
phRefresh.Contr ols.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.asc x")
phUploader.Cont rols.Clear()
phResults.Contr ols.Clear()
phWait.Controls .Add(WaitCnt)

'pnlUploadFile. Visible = False
'pnlWait.Visibl e = True

'''Problem
Dim objUpload As New UploadCnt
objUpload.Uploa dData()
Else

' get query string
Dim iUpload As String = Request.QuerySt ring("Upload")
If iUpload = "" Then

'pnlUploadFile. Visible = True
Dim UploadFrmCnt As Control =
LoadControl("../binFileUpload/UploadCnt.ascx" )
phWait.Controls .Clear()
phResults.Contr ols.Clear()
phUploader.Cont rols.Add(Upload FrmCnt)

Else
phUploader.Cont rols.Clear()
phWait.Controls .Clear()
Dim ResultsCnt As Control =
LoadControl("../binFileUpload/ResultsCnt.ascx ")
phResults.Contr ols.Add(Results Cnt)

End If
Dim sRefreshURL As String = Request.Url.ToS tring() &
"?Upload=Fa lse"
"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_hotm ail.com> wrote in message
news:41******** *************** ***********@mic rosoft.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(Send er As
Object, e As System.EventArg s)
If Page.IsPostBack Then
Dim objUpload As New UploadCnt
objUpload.Uploa dData()
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_hotm ail.com> wrote in message
news:2C******** *************** ***********@mic rosoft.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.ToS tring() &
"?Upload=Tr ue"

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.Contr ols.Clear()
phRefresh.Contr ols.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.Contr ols.Clear()
phRefresh.Contr ols.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.asc x")
phUploader.Cont rols.Clear()
phResults.Contr ols.Clear()
phWait.Controls .Add(WaitCnt)

'pnlUploadFile. Visible = False
'pnlWait.Visibl e = True

'''Problem
Dim objUpload As New UploadCnt
objUpload.Uploa dData()
Else

' get query string
Dim iUpload As String = Request.QuerySt ring("Upload")
If iUpload = "" Then

'pnlUploadFile. Visible = True
Dim UploadFrmCnt As Control =
LoadControl("../binFileUpload/UploadCnt.ascx" )
phWait.Controls .Clear()
phResults.Contr ols.Clear()
phUploader.Cont rols.Add(Upload FrmCnt)

Else
phUploader.Cont rols.Clear()
phWait.Controls .Clear()
Dim ResultsCnt As Control =
LoadControl("../binFileUpload/ResultsCnt.ascx ")
phResults.Contr ols.Add(Results Cnt)

End If
Dim sRefreshURL As String = Request.Url.ToS tring() &
"?Upload=Fa lse"
"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_hotm ail.com> wrote in message
news:41******** *************** ***********@mic rosoft.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(Send er As Object, e As System.EventArg s)
If Page.IsPostBack Then
Dim objUpload As New UploadCnt
objUpload.Uploa dData()
End IF


Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
12686
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 overwritten. I think this is some sort of post back problem but i can't seem to figure out how to solve it. Can someone help me with this please. ...
2
3173
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 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/creatingcustomcolumns.asp The problem I am having is that the data in the custom datagridcolumn is not saved to viewstate and after...
1
11541
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 http://weblogs.asp.net/asmith/archive/2003/09/15/27684.aspx but it was far more complex then I needed. (I got lost trying to figure it all...
6
2385
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 postback. Here's the deal : From now on, I set CurrentThread.CurrentCulture only during PageLoad. so date and currency format is incorrect if page load is...
0
2082
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 sets a connection string to the database. The content page has a simple gridview that should show records from the selected database. Initial...
7
4603
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, the client-side validation is executed immediately and the errors flash up on screen. However at the same time, a post-back is performed and the...
11
14792
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 processed by the web server. I am still struggling to understand this postback logic, and hope that some kind gurus out there could help me clarify...
2
1398
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" AutoPostBack="true" EnableViewState="False" OnSelectedIndexChanged="tester_SelectedIndexChanged"> <asp:ListItem Text="All" Value="ALL"></asp:ListItem>...
2
2195
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. When the user is clicking the mouse on the slider during a partial postback, an error occurs. I have a Ajax Timer which causes a postback every...
0
7402
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7347
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7590
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7344
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7684
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5264
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4890
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3388
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
963
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.