473,396 Members | 1,997 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,396 software developers and data experts.

Identify wich button was pressed!


Hello,

I have a web form with three buttons among other things.
I need to know wich one of my buttons was pressed .
The problem is that i want my page to be valid before any of the
buttons "click" routines can do some processing , meaning that they have the
"Causevalidation" property set to true.

The validation routines depends upon which of the buttons was pressed.
How can i identify them in my validation routine?

Thanks in advance.
Nov 18 '05 #1
5 1918
"bredal Jensen" <br******@mimosa.com> wrote in message
news:OS**************@TK2MSFTNGP11.phx.gbl...

Hello,

I have a web form with three buttons among other things.
I need to know wich one of my buttons was pressed .
The problem is that i want my page to be valid before any of the
buttons "click" routines can do some processing , meaning that they have the "Causevalidation" property set to true.

The validation routines depends upon which of the buttons was pressed.
How can i identify them in my validation routine?


Why not simply check Page.IsValid in the click routines before doing the
processing?
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #2
Wire up each of the buttons to the same event handler. When you get in
there the button that was clicked would have passed itself through the
postback. Getting the objects UniqueID will give you the Id of the button
that was clicked. Alternatively wireup a handler for each button and have
then all call your validation method.

MattC

"bredal Jensen" <br******@mimosa.com> wrote in message
news:OS**************@TK2MSFTNGP11.phx.gbl...

Hello,

I have a web form with three buttons among other things.
I need to know wich one of my buttons was pressed .
The problem is that i want my page to be valid before any of the
buttons "click" routines can do some processing , meaning that they have the "Causevalidation" property set to true.

The validation routines depends upon which of the buttons was pressed.
How can i identify them in my validation routine?

Thanks in advance.

Nov 18 '05 #3
If you use Request.Form["__EVENTTARGET"] and html buttons you can understand
on submit which control was causin the submit

Regards
Martin
"bredal Jensen" <br******@mimosa.com> wrote in message
news:OS**************@TK2MSFTNGP11.phx.gbl...

Hello,

I have a web form with three buttons among other things.
I need to know wich one of my buttons was pressed .
The problem is that i want my page to be valid before any of the
buttons "click" routines can do some processing , meaning that they have the "Causevalidation" property set to true.

The validation routines depends upon which of the buttons was pressed.
How can i identify them in my validation routine?

Thanks in advance.

Nov 18 '05 #4

That was brillant , thank you a lot !

"MattC" <m@m.com> wrote in message
news:eI**************@tk2msftngp13.phx.gbl...
Wire up each of the buttons to the same event handler. When you get in
there the button that was clicked would have passed itself through the
postback. Getting the objects UniqueID will give you the Id of the button
that was clicked. Alternatively wireup a handler for each button and have
then all call your validation method.

MattC

"bredal Jensen" <br******@mimosa.com> wrote in message
news:OS**************@TK2MSFTNGP11.phx.gbl...

Hello,

I have a web form with three buttons among other things.
I need to know wich one of my buttons was pressed .
The problem is that i want my page to be valid before any of the
buttons "click" routines can do some processing , meaning that they have

the
"Causevalidation" property set to true.

The validation routines depends upon which of the buttons was pressed.
How can i identify them in my validation routine?

Thanks in advance.


Nov 18 '05 #5
That does not solve my problem as i explained earlier.

I need to do validation before any processing in my "click routine" .
The problem is that Validation depends upon which button was clicked.

I hope you understands the problem.

Check out "MattC" reply , the problem can be solved by delegates
as he suggested....
Many Thanks


"John Saunders" <jo**************@notcoldmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
"bredal Jensen" <br******@mimosa.com> wrote in message
news:OS**************@TK2MSFTNGP11.phx.gbl...

Hello,

I have a web form with three buttons among other things.
I need to know wich one of my buttons was pressed .
The problem is that i want my page to be valid before any of the
buttons "click" routines can do some processing , meaning that they have

the
"Causevalidation" property set to true.

The validation routines depends upon which of the buttons was pressed.
How can i identify them in my validation routine?


Why not simply check Page.IsValid in the click routines before doing the
processing?
--
John Saunders
johnwsaundersiii at hotmail

Nov 18 '05 #6

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

Similar topics

1
by: robert | last post by:
hi! I want to have a custom button change appearance when pressed and then call a function and change back to its original appearance when released. here's what i have now, which works mostly....
2
by: jb | last post by:
Hello, I need to know which button was pressed in the submit , i tried reading the vaule of submit it the validateDate function but it returns 'undefined' value ; I do this in asp all the time, Not...
8
by: Syed Ali | last post by:
Hello, I have 1 HTML form with 4 submit buttons and 10 textfield entry areas. If submit button1 is pressed I need to make sure that all 10 textfield entries have been filled before submitting...
0
by: Marko | last post by:
Hello! We are deweloping a web service wich does some processing depending on wich user called it. The problem is that the web service has to know wich user made a call to it. In IIS the...
18
by: jrhoads23 | last post by:
Hello, I am trying to find a way to tell if an .NET windows forms Button (System.Windows.Forms.Button) is "depressed" (pushed down). For my application, I can not use a check box control set to...
7
by: Amadelle | last post by:
Hi all and thanks in advance, I am stuck! I can't figure out how to identify which button was clicked on my ASP.NET page in the PostBack event? So what I am trying to do is to is to have an if...
2
by: Vishwanathan Raman | last post by:
Hi I am building a Search Interface.It has two text boxes (box1 and box2) and two buttons (btnbox1 and btnbox2) in the ASPX page. Example User keys in a search text in box2 and presses the...
19
by: darrel | last post by:
On my vb.net page, I have 4 sets of inputs + form buttons. example: Search: (GO) Zip: (GO) County: (GO) County: (GO) The problem is if I go to the page, type in a zip code, and hit...
4
by: Rob | last post by:
Using VS 2005 I have an application whereby the user clicks on numbered buttons in order to "build" a number.... (kind of like the calulator application). Example... if they click on the 1...
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:
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
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,...
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
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.