473,545 Members | 2,051 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Which button was pressed ?

I have a project in VS.NET using C#
I have a series of buttons on an aspx page. When one of the buttons is pressed, a panel becomes visible and allows the user to enter and edit data. I want to use this data to modify the text of the button
I am thinking of storing a unique identifier in View State when the button is pressed. After the user enters or edits the data, I plan use a Switch structure indexed from the number stored in View State to be able to identify the previously pressed button so that I can then change the text of the button
Is there an easier way to accomplish this task
Sample code would be appreciated
Thanks for your help
Jim
Jul 21 '05 #1
3 1947
Hi Jim,

You can get the information from the "sender" parameter of the Click event.
For example:

Panel1.Text=((S ystem.Web.UI.We bControls.Butto n)sender).ID.To String();

Does this help? Feel free to let me know if I misunderstood your questions.

Thanks,

Felix Wu
=============
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Thread-Topic: Which button was pressed ?
thread-index: AcPue37+fqmWF56 iQtWVeacpNoQ4Rg ==
X-Tomcat-NG: microsoft.publi c.dotnet.genera l
From: "=?Utf-8?B?SmFtZXMgTWN HaXZuZXk=?=" <ac*****@acura6 6.com>
Subject: Which button was pressed ?
Date: Sun, 8 Feb 2004 11:41:07 -0800
Lines: 7
Message-ID: <EA************ *************** *******@microso ft.com>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.publi c.dotnet.genera l
Path: cpmsftngxa07.ph x.gbl
Xref: cpmsftngxa07.ph x.gbl microsoft.publi c.dotnet.genera l:124043
NNTP-Posting-Host: tk2msftcmty1.ph x.gbl 10.40.1.180
X-Tomcat-NG: microsoft.publi c.dotnet.genera l

I have a project in VS.NET using C#. I have a series of buttons on an aspx page. When one of the buttons is
pressed, a panel becomes visible and allows the user to enter and edit
data. I want to use this data to modify the text of the button.
I am thinking of storing a unique identifier in View State when the button
is pressed. After the user enters or edits the data, I plan use a Switch
structure indexed from the number stored in View State to be able to
identify the previously pressed button so that I can then change the text
of the button.
Is there an easier way to accomplish this task ?
Sample code would be appreciated.
Thanks for your help,
Jim


Jul 21 '05 #2
Thanks for the help. It makes the job easier
Jim
Jul 21 '05 #3
I have the same requirement.

I.E to identify the button clicked on Post Back.
How do I do this?

Any help appreciated.

Seshadri

*************** *************** *************** *************** **********
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Jul 21 '05 #4

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

Similar topics

8
14631
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 the form. If submit button2 is pressed I need to make sure that only textfied1 is filled before submitting the form.
4
4120
by: actionwoman63 | last post by:
Dear all I need to be able to check which one out of two submit buttons within the same form was pressed in a javascript function prior to form submission. And before I get flamed for not finding the answer in previous posts - I have already seen this question answered numerous times in this forum, only problem is that the recommended...
18
3028
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 button style, I must use a System.Windows.Forms.Button. I can not find a way to tell when it is momentaraly pressed. I tried calling the API...
2
2530
by: Vern | last post by:
I have a custom control which has it's own OnValidating event handler. I would like to skip the validations if the Cancel/Exit button is pressed. Also, if possible, would like to skip the validations if the X was clicked to close the form. How can I do this? Thanks, Vern
7
16008
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 statement like as follows in the PageLoad: private void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { //do something...
3
291
by: James McGivney | last post by:
I have a project in VS.NET using C# I have a series of buttons on an aspx page. When one of the buttons is pressed, a panel becomes visible and allows the user to enter and edit data. I want to use this data to modify the text of the button I am thinking of storing a unique identifier in View State when the button is pressed. After the user...
19
2162
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 enter.
3
1745
by: noddy | last post by:
I have a button <input type="button" value="Get data"> When it is clicked a database is accessed and the data is eventually displayed on the screen. While the data is being retrieved the button is displayed in its "pressed in" state. When the data arrives and is displayed the button pops out to its normal "unpressed" state.
8
2172
by: MAX2006 | last post by:
Hi, I am doing some client side javascipt work. I have a handler for window.onUnload event and within the code; I need to know the name of the asp.net button caused the postback. How can I do that? Thank you Max
0
7409
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
7918
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...
0
7766
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...
0
5981
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...
1
5341
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
3463
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...
0
3446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1897
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
0
715
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...

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.