473,396 Members | 1,655 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.

How to tell the difference between two push buttons in a datagrid

I have added two pushbuttons, Select and Update, in a DataGrid, grdFiles, by
Property Builder.

It seems that there is only one event handler for both,
private void grdFiles_SelectedIndexChanged(object sender, System.EventArgs e)
in my application code.

How to add two separate event handlers to handle the push events from these
two buttons, respectively?

Thanks

David
Mar 7 '07 #1
2 1420
You don't need two separate event handlers. You can tell which button
created the event by casting the sender parameter to type Button and looking
at the ID.

Then your handler can have a switch statment (select case in vb.net) to do
your processing.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"david" wrote:
I have added two pushbuttons, Select and Update, in a DataGrid, grdFiles, by
Property Builder.

It seems that there is only one event handler for both,
private void grdFiles_SelectedIndexChanged(object sender, System.EventArgs e)
in my application code.

How to add two separate event handlers to handle the push events from these
two buttons, respectively?

Thanks

David
Mar 7 '07 #2
thanks

"Peter Bromberg [C# MVP]" wrote:
You don't need two separate event handlers. You can tell which button
created the event by casting the sender parameter to type Button and looking
at the ID.

Then your handler can have a switch statment (select case in vb.net) to do
your processing.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"david" wrote:
I have added two pushbuttons, Select and Update, in a DataGrid, grdFiles, by
Property Builder.

It seems that there is only one event handler for both,
private void grdFiles_SelectedIndexChanged(object sender, System.EventArgs e)
in my application code.

How to add two separate event handlers to handle the push events from these
two buttons, respectively?

Thanks

David
Mar 7 '07 #3

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

Similar topics

6
by: BBFrost | last post by:
I'm using Net 1.1 (2003) SP1 & Windows 2000 Here's the issue ... Rows 12 thru 24 are selected in a datagrid. The user now unselects rows 12 thru 24 and selects rows 45 thru 70 ??? How can...
3
by: Jay | last post by:
I noticed somewhere on the net that a post mentioned that there was a bug in the datagrid, radio buttons and a repeater. Something about the radio buttons are not mutually exclusive. (will this be...
1
by: Jay | last post by:
I need to validate 21 sets of radio buttons before submission to the server for calculation and storage. Is it best to validate on the client side using javascript or to validate on the server...
0
by: Steve Kallal | last post by:
I have a DataGrid with an EditCommandColumn column set to a type of PushButton. I want to set set CssClass on these buttons and cannot without using code-behind code on the ItemDataBound event. The...
3
by: pmud | last post by:
Hi, I have an ASP.NET application using C# code. I am using a datagrid to display records from a database based on a user input, i.e a user enters a compnay name in text box & when he clicks a...
0
by: ujjc001 | last post by:
Hello all. Is there a way to know if my datagrid is wider than my div layer? This is hard since the width on datagrid = 100% so it will not scroll, leaving the scrolling to the div layer. The...
5
by: Vik | last post by:
If there are a few Select buttons in a datagrid, is there a way to distinguish in code which button was clicked? Thanks.
0
by: slemen | last post by:
Hi, The asp:EditCommandColumn template does not fire the _edit sutboutine when the edit command column buttons are clicked. I get a Page Cannot Be Displayed page error instead. My (ASP 1.1)...
2
by: Amal P | last post by:
Hi, This is the program that i made to test the usage of inline function. I am using vc 6.0 compiler. Please see the below program. int NonInline( int a, int b ) { return ( a b )? a: b; }
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
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,...

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.