473,769 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.W ebControls.Form ViewInsertedEve ntArgs)
TextBox1.Text = "ok"
End Sub

aspx file:
<InsertItemTemp late>
......
<asp:LinkButt on ID="InsertButto n" runat="server" OnClick="myproc "
CausesValidatio n="True" CommandName="In sert" Text="Insert">
</asp:LinkButton>
......
</InsertItemTempl ate>

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

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

Protected Sub myproc2(ByVal sender As Object, ByVal e As System.EventArg s)
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 1242
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.W ebControls.Form ViewInsertedEve ntArgs)
TextBox1.Text = "ok"
End Sub

aspx file:
<InsertItemTemp late>
.....
<asp:LinkButt on ID="InsertButto n" runat="server" OnClick="myproc "
CausesValidatio n="True" CommandName="In sert" Text="Insert">
</asp:LinkButton>
.....
</InsertItemTempl ate>

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

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

Protected Sub myproc2(ByVal sender As Object, ByVal e As System.EventArg s)
My questions:
1)why does my first example not work and my second does well?
The OnClick event doesn't send a FormViewInserte dEventArgs 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:ImageButto n ID="ImageButton 1" runat="server" OnClick="myproc "
ImageUrl="~/logos/batman.png" /><br />

Thanks
"Göran Andersson" <gu***@guffa.co mschreef in bericht
news:uR******** ******@TK2MSFTN GP06.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.For mViewInsertedEv entArgs)
TextBox1.Text = "ok"
End Sub

aspx file:
<InsertItemTemp late>
.....
<asp:LinkButto n ID="InsertButto n" runat="server" OnClick="myproc "
CausesValidati on="True" CommandName="In sert" Text="Insert">
</asp:LinkButton>
.....
</InsertItemTempl ate>

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

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

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

The OnClick event doesn't send a FormViewInserte dEventArgs 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:ImageButto n ID="ImageButton 1" 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.co mschreef in bericht
news:u2******** ******@TK2MSFTN GP03.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:ImageButt on ID="ImageButton 1" 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
6113
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 Timed out) I am using the Data Access Application Blocks as ASP.NET (using VB.NET) and SQL 2000. In there first question there can be up to 27 answers. So I figured instead of making 27 different trips to the database I woulc just concatenate my...
13
10447
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 change the parameter data types to the actual data type such as varchar(10), etc., the stored procedure takes less that a second to return records. The user defined types are mostly varchar, but some others such as int. They are all input type...
2
5485
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, produce a "function not defined" message when the SELECT statement is executed, even having previously worked on that machine. What can I do to correct this difficulty when it occurs? What do I need to know about user-defined functions in SELECT...
4
1390
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 the procedure described in the Access Security FAQ and as I have been doing since the time I have started using Access. So let the access application be xxx.mdb. After completing the whole development for xxx.mdb, i secured it using the procedure...
3
1773
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 AddCompany to insert the company name from the Company Name textbox into the COMPANY table and return the @@IDENTITY of the company name just input into the database back to a label on the form. THIS IS WORKING.
2
2808
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 "TimeTracker Start-up Kit" for my needs. ****** BEGINING OF TIME TRACKER SUMMARY ***** First, in the "TimeTracker Start-Up Kit" they appear to have tried to set it up so that it can be expanded to any number of different datasource types (SQL, Access,...
4
3996
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 but when he runs the stored procedure, he gets the following error message. "SYSPROC".CSGCSB54 - Run started. Data returned in result sets is limited to the first 100 rows. Data returned in result set columns is limited to the first 20...
1
2975
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 recompiling/executing the code with 1.4.1 (deploying the newly compiled stored procedure code as well). This is the original exception that I got before I tried any code modifications: java.io.IOException: invalid offset/length at...
1
4570
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. TYPE R_OutData_tab IS RECORD ( ... ); TYPE OutData_tab IS TABLE OF R_OutData_tab INDEX BY BINARY_INTEGER; PROCEDURE PROPERTY_GET (tOutData OUT <packagename>.OutData_tab);
1
6435
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) field I am trying to update. Here's how I'm doing it. I have a strongly typed dataset in c#. The column in question is defined as System.Byte LogoImage,
0
9422
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10206
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10035
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8863
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7403
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6662
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3949
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2811
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.