Simulate Datagrid LinkButton Click?

  • Thread starter leanne lis via .NET 247
  • Start date
L

leanne lis via .NET 247

How can I simulate a click on a linkbutton in a datagrid?

I've got a linkbutton with text 'edit'. The user clicks on it, does some editing, and submits. I then change the linkbutton text to 'view', and need to re-display the transaction they just edited as though they had clicked the 'view' linkbutton.

If I manually click the linkbutton, I get the results I want; so how can I do this programmatically, so the user won't have to click the linkbutton after submitting the transaction???

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'
LinkButton linkButton =
( ( LinkButton ) dgRow.Cells[ 9 ].Controls[ 0 ] );
linkButton.Text = "View";

// call ItemCommand event where transaction will be redrawn -
// dgTxnHistory_ItemCommand( object source, DataGridCommandEventArgs e )
dgTxnHistory_ItemCommand( source, e );

******
but, if that would work, what do I need in the 'source' and 'e' params? Or, is there an easier way? (I'm using C#)

thanks for any help you can offer!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top