DIGIT-ARC read-only archive · snapshot: July 23, 2026

c# problem

10 posts · originally from https://geek.digit.in/community/threads/c-problem.122439/

S
sumigizlov Original post #1
Nov 11, 2009 at 11:08 PM
i was trying to add a button column to the windows forms datagridview but i do not know the event that will be fired on clicking the button in asp it is the item command event but there is no such event in windows form datagridview
please help
krishnandu.sarkar
Nov 11, 2009 at 11:14 PM
As far i know button_click event will b fired. But for that u need to write the gridview_rowcommand event for that button.

May b I'm wrong. I'm not so sure. I forgot.....!!
S
Nov 11, 2009 at 11:50 PM
but in case of windows forms datagridview RowCommand is not available it is only available in asp.net
vamsi360
Nov 11, 2009 at 11:51 PM
when you click the button the event is button_click.

When you want to fire the event on page load Page_Load
S
Nov 11, 2009 at 11:53 PM
i am not asking for regular buttons i am asking for datagridview button column
krishnandu.sarkar
Nov 11, 2009 at 11:56 PM
Ya RowCommand is available in ASP.NET. U r in Windows......Sorry I didn't noticed.

So what r u asking? The ques is not clear not even now. As u said what will b the event in ASP.
S
Nov 12, 2009 at 12:01 AM
yes in asp it is rowcommand but i am asking for windows form
L
Nov 12, 2009 at 12:35 PM
Handle the CellContentClick event of the DataGridView.

Evaluate DataGridView.Columns(e.ColumnIndex).Name to get the name of the column clicked

If it's your button column, then you can get the value of any cell in that row with

DataGridView.CurrentRow.Cells["ColumnNameHere"].Value
S
Nov 12, 2009 at 1:02 PM
thanks lucifer_is_back your suggestion worked like a charm
but there is still one glitch the first time i click the button it works perfectly but on subsequent click it has no effect
vamsi360
vamsi360 #10
Nov 13, 2009 at 8:39 PM
*msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcellvalueeventargs(VS.85).aspx