Which button was pressed ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Hi Jim,

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

Panel1.Text=((System.Web.UI.WebControls.Button)sender).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=?=" <[email protected]>
Subject: Which button was pressed ?
Date: Sun, 8 Feb 2004 11:41:07 -0800
Lines: 7
Message-ID: <[email protected]>
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
 
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...
 
Back
Top