By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,839 Members | 2,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,839 IT Pros & Developers. It's quick & easy.

Which button was pressed ?

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
Hi Jim,

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

Panel1.Text=((System.Web.UI.WebControls.Button)sen der).ID.ToString();

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+fqmWF56iQtWVeacpNoQ4Rg==
X-Tomcat-NG: microsoft.public.dotnet.general
From: "=?Utf-8?B?SmFtZXMgTWNHaXZuZXk=?=" <ac*****@acura66.com>
Subject: Which button was pressed ?
Date: Sun, 8 Feb 2004 11:41:07 -0800
Lines: 7
Message-ID: <EA**********************************@microsoft.co m>
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.public.dotnet.general
Path: cpmsftngxa07.phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.general:124043
NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
X-Tomcat-NG: microsoft.public.dotnet.general

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

P: n/a
Thanks for the help. It makes the job easier
Jim
Jul 21 '05 #3

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.