Simulate Datagrid LinkButton Click?

Discussion in 'ASP .Net Datagrid Control' started by leanne lis via .NET 247, Jun 5, 2004.

  1. 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!

    --------------------------------
    From: leanne lis

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>hmW9JJk2zE+BwmGuHyvx9w==</Id>
     
    leanne lis via .NET 247, Jun 5, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RGF2ZQ==?=

    Execute javascript on a DataGrid's LinkButton click?

    =?Utf-8?B?RGF2ZQ==?=, Jun 17, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    10,961
  2. Sathyaish
    Replies:
    3
    Views:
    3,151
    Sathyaish
    Sep 8, 2005
  3. =?Utf-8?B?SmFrb2IgTGl0aG5lcg==?=

    Simulate linkbutton click on submit

    =?Utf-8?B?SmFrb2IgTGl0aG5lcg==?=, Apr 26, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    1,633
    Walter Wang [MSFT]
    May 2, 2007
  4. cluelis via .NET 247

    How to Simulate Click Event on DG LinkButton?

    cluelis via .NET 247, May 23, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    282
    Alvin Bruney [MVP]
    May 23, 2004
  5. Sathyaish

    Linkbutton does not look like a linkbutton

    Sathyaish, Sep 8, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    207
    Sathyaish
    Sep 8, 2005
Loading...

Share This Page