C
cluelis via .NET 247
How can I programmatically simulate a click event on a datagrid linkbutton?
I change the text of a linkbutton in a datagrid, then need to do some processing as though the user had clicked the linkbutton with the new text.
I thought I could do it like this:
***
// get datagrid item (row)
DataGridItem dgRow = dgTxnHistory.Items[ dgRowIndex ];
// change linkbutton in this datagrid row to show 'view' (it was 'edit')
LinkButton linkButton =
( ( Linkbutton ) dgRow.Cells[ 9 ].Controls[ 0 ] );
linkButton.Text = "View";
// 'click' the above linkbutton
dgTxnHistory_ItemCommand( object source, DataGridCommandEventArgs e );
***
But, I have no idea what to put in the 'source' and 'e' parameter positions. I tried using linkButton.Click, too, but that gave me an error.
I'd appreciate any help you can offer!
I change the text of a linkbutton in a datagrid, then need to do some processing as though the user had clicked the linkbutton with the new text.
I thought I could do it like this:
***
// get datagrid item (row)
DataGridItem dgRow = dgTxnHistory.Items[ dgRowIndex ];
// change linkbutton in this datagrid row to show 'view' (it was 'edit')
LinkButton linkButton =
( ( Linkbutton ) dgRow.Cells[ 9 ].Controls[ 0 ] );
linkButton.Text = "View";
// 'click' the above linkbutton
dgTxnHistory_ItemCommand( object source, DataGridCommandEventArgs e );
***
But, I have no idea what to put in the 'source' and 'e' parameter positions. I tried using linkButton.Click, too, but that gave me an error.
I'd appreciate any help you can offer!