Pass Value with Click event.
I am using cell click event and I would like to pass two more variable which are not available in the cell. How can I do that?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Feb 21, 2014, 4:37 PM
The EventArgs parameter is just a shell and you have no control over what's passed when the context menu is clicked in any case.
Lio LiovPosted Feb 21, 2014, 1:16 PM
I do have a ultragrid and I am assigniing to a cell of the grid this context menu.
I am trying to pass a variable from the same row to the OnClick method so I can access it inside OpenWith_OnClick.
contextMenu.MenuItems.Add("OpenWith",new System.EventHandler(OpenWith_OnClick));
private static void OpenWith_OnClick(object sender, System.EventArgs args)
{
MessageBox.Show("Test");
}
Hemant SrivastavaPosted Feb 21, 2014, 11:37 AM
I'm not sure about the Infrgistic grid but on the regular dataGridView Control, you can get the other cell value in the following way:
dataGridView1[x,e.RowIndex].Value, where x is the column index of the other cell
Lio LiovPosted Feb 21, 2014, 11:19 AM
Hemant SrivastavaPosted Feb 21, 2014, 11:13 AM
Which two variables ... are they in the same row ?
Is it dataGridView control of Winform?