Two Select LinkButton's in DataGrid

Discussion in 'ASP .Net' started by George Durzi, Apr 23, 2005.

  1. George Durzi

    George Durzi Guest

    I have to LinkButtons in a DataGrid, and each of them has a Command="Select"
    attribute set up.
    When either of hte LinkButton's is clicked, I want the proper row in the
    DataGrid to be selected, but I then want to do a different operation
    depending on which LinkButton was clicked.

    Here's some of the Html out of my DataGrid

    <asp:LinkButton ID="lnkViewEdit" Runat="server" CommandName="Select"
    CausesValidation="false" Text="View"/>
    <asp:TemplateColumn HeaderText="Status">
    <asp:LinkButton ID="lnkStatus" Runat="server" CommandName="Select"
    CausesValidation="False" Text='<%# DataBinder.Eval(Container,
    "DataItem.Status")%>' OnClick="lnkStatus_OnClick"/>

    In my dgIssues_OnSelectedIndexChanged DataGrid event, I can't see a way to
    figure out a way to find out which LinkButton raised the event.

    I tried adding an OnClick event to my second LinkButton, lnkStatus. When
    debugging I realized that this event is called BEFORE the
    dgIssues_OnSelectedIndexChanged event. I wanted to do the custom operation
    if the second LinkButton was clicked AFTER the
    dgIssues_OnSelectedIndexChanged event was called.

    Thanks in advance for any help or tips.
    George Durzi, Apr 23, 2005
    1. Advertisements

  2. George Durzi

    Karl Seguin Guest

    What about specifying a CommandArgument and then checking the
    e.CommandArgument property?

    Karl Seguin, Apr 24, 2005
    1. Advertisements

  3. George Durzi


    Nov 30, 2011
    Likes Received:
    use itemcommand property in the data grid then you can easily get it
    Madhuri.ssr, Nov 30, 2011
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.