473,398 Members | 2,088 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,398 software developers and data experts.

problem with own defined procedure

Hi,

i have a formview in Insert mode.
when a new record is inserted, the text of a textbox becomes: "ok".
Instead of using the ItemInserted or ItemInserting, i use my own procedure
like this:

Protected Sub myproc((ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.FormViewInsertedEventArg s)
TextBox1.Text = "ok"
End Sub

aspx file:
<InsertItemTemplate>
......
<asp:LinkButton ID="InsertButton" runat="server" OnClick="myproc"
CausesValidation="True" CommandName="Insert" Text="Insert">
</asp:LinkButton>
......
</InsertItemTemplate>

But this gives an error (not same signature ...)

This second example works:
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="myproc2" />

Protected Sub myproc2(ByVal sender As Object, ByVal e As System.EventArgs)
My questions:
1)why does my first example not work and my second does well?
2) how to correct the first example?

Thanks you very much
Chris
Jun 9 '07 #1
4 1220
Chris wrote:
Hi,

i have a formview in Insert mode.
when a new record is inserted, the text of a textbox becomes: "ok".
Instead of using the ItemInserted or ItemInserting, i use my own procedure
like this:

Protected Sub myproc((ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.FormViewInsertedEventArg s)
TextBox1.Text = "ok"
End Sub

aspx file:
<InsertItemTemplate>
.....
<asp:LinkButton ID="InsertButton" runat="server" OnClick="myproc"
CausesValidation="True" CommandName="Insert" Text="Insert">
</asp:LinkButton>
.....
</InsertItemTemplate>

But this gives an error (not same signature ...)

This second example works:
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="myproc2" />

Protected Sub myproc2(ByVal sender As Object, ByVal e As System.EventArgs)
My questions:
1)why does my first example not work and my second does well?
The OnClick event doesn't send a FormViewInsertedEventArgs object to the
event handler.
2) how to correct the first example?
Use EventArgs instead, just like in the second example.

--
Göran Andersson
_____
http://www.guffa.com
Jun 9 '07 #2
Hi, thanks for replying..
It works now (of course).
One more remark:
I guess what the OnClick sends to the procdure is function of the clicked
object, right?
But how can i know what the OnClick sends to the procedure? Does it exist a
list of that for each clickable control or something ..?

For instance: a click on an Image_button like here, what does that send to
the procedure? mean: how do i have to make the declaration of the
procedure?
<asp:ImageButton ID="ImageButton1" runat="server" OnClick="myproc"
ImageUrl="~/logos/batman.png" /><br />

Thanks
"Göran Andersson" <gu***@guffa.comschreef in bericht
news:uR**************@TK2MSFTNGP06.phx.gbl...
Chris wrote:
>Hi,

i have a formview in Insert mode.
when a new record is inserted, the text of a textbox becomes: "ok".
Instead of using the ItemInserted or ItemInserting, i use my own
procedure like this:

Protected Sub myproc((ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.FormViewInsertedEventAr gs)
TextBox1.Text = "ok"
End Sub

aspx file:
<InsertItemTemplate>
.....
<asp:LinkButton ID="InsertButton" runat="server" OnClick="myproc"
CausesValidation="True" CommandName="Insert" Text="Insert">
</asp:LinkButton>
.....
</InsertItemTemplate>

But this gives an error (not same signature ...)

This second example works:
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="myproc2"
/>

Protected Sub myproc2(ByVal sender As Object, ByVal e As
System.EventArgs)
My questions:
1)why does my first example not work and my second does well?

The OnClick event doesn't send a FormViewInsertedEventArgs object to the
event handler.
>2) how to correct the first example?

Use EventArgs instead, just like in the second example.

--
Göran Andersson
_____
http://www.guffa.com

Jun 9 '07 #3
Chris wrote:
Hi, thanks for replying..
It works now (of course).
One more remark:
I guess what the OnClick sends to the procdure is function of the clicked
object, right?
As far as I know, no Click events send any extra information to the handler.
But how can i know what the OnClick sends to the procedure? Does it exist a
list of that for each clickable control or something ..?
If an event is sent any extra information, it will use some other class
than EventArgs.
For instance: a click on an Image_button like here, what does that send to
the procedure? mean: how do i have to make the declaration of the
procedure?
<asp:ImageButton ID="ImageButton1" runat="server" OnClick="myproc"
ImageUrl="~/logos/batman.png" /><br />
The easiest way is to use the designer in Visual Studio. If you add the
event in the designer, it will create a method stub with the correct
parameters.

Otherwise you can look up the events in the documentation.

--
Göran Andersson
_____
http://www.guffa.com
Jun 9 '07 #4
thanks

"Göran Andersson" <gu***@guffa.comschreef in bericht
news:u2**************@TK2MSFTNGP03.phx.gbl...
Chris wrote:
>Hi, thanks for replying..
It works now (of course).
One more remark:
I guess what the OnClick sends to the procdure is function of the clicked
object, right?

As far as I know, no Click events send any extra information to the
handler.
>But how can i know what the OnClick sends to the procedure? Does it exist
a list of that for each clickable control or something ..?

If an event is sent any extra information, it will use some other class
than EventArgs.
>For instance: a click on an Image_button like here, what does that send
to the procedure? mean: how do i have to make the declaration of the
procedure?
<asp:ImageButton ID="ImageButton1" runat="server" OnClick="myproc"
ImageUrl="~/logos/batman.png" /><br />

The easiest way is to use the designer in Visual Studio. If you add the
event in the designer, it will create a method stub with the correct
parameters.

Otherwise you can look up the events in the documentation.

--
Göran Andersson
_____
http://www.guffa.com

Jun 10 '07 #5

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

Similar topics

3
by: DarthMacgyver | last post by:
Hello, I recently wrote a survey application. Each question is very similar. The first questions gives me a problem when there are multiple people taking the survey (The Database connection...
13
by: dawatson833 | last post by:
I have several stored procedures with parameters that are defined with user defined data types. The time it takes to run the procedures can take 10 - 50 seconds depending on the procedure. If I...
2
by: David Emme | last post by:
Access 97 I have a number of SELECT statements which contain references to user-defined VBA functions. These typically work as expected, but occasionally, on one user's machine or another,...
4
by: xunitinmullik | last post by:
Hello ppl: I am facing a problem that I ahve never experienced before with the secured database. I created an MS Access 2000 application (.mdb) using MS Access 2002 and secured it using exactly...
3
by: Bilbo | last post by:
I have a a headscratcher here: I have a form that when submitted should do 2 things when a user enters data and then clicks the Add button. Here goes: 1. Call a stored procedure called...
2
by: timpera2501 | last post by:
I am a newb to OOP programming and I'm only just starting with C#. I've done a TON of reading lately, and I'm currently in the process of modifying some of the function provided by the...
4
by: nishi57 | last post by:
I hope I can get some help regarding this issue, which has been going on for a while. I have a desktop user who is having problem running "Stored Procedures". The DB2 Connect application works fine...
1
by: amgupta8 | last post by:
Note: This problem occurred when I updated the JDK from 1.3.1 to 1.4.1 or 1.4.2. Nothing else was changed in the code, other than updating the JDK on the database server (dbm cfg parm jdk_path) and...
1
by: Mikael Vehkajärvi | last post by:
Hello I am running ASP.NET (C#) using Oracle (PL/SQL, provider ODP.NET 11.1.0.6.20) and I have a procedure which at the moment returns a table of records. The code below demonstrates this. ...
1
by: quintonmartin | last post by:
Here's my problem. I have a client application that uses a web service for data access. I can read/update many records in many tables, however, I am not getting what I expect for a varbinary(max)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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,...
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...
0
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...
0
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...

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.