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

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

  2. George Durzi

    Karl Seguin Guest

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

    Karl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
    http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
    come!)


    "George Durzi" <> wrote in message
    news:...
    >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:TemplateColumn>
    > <ItemTemplate>
    > <asp:LinkButton ID="lnkViewEdit" Runat="server"
    > CommandName="Select" CausesValidation="false" Text="View"/>
    > </ItemTemplate>
    > </asp:TemplateColumn>
    > <asp:TemplateColumn HeaderText="Status">
    > <ItemTemplate>
    > <asp:LinkButton ID="lnkStatus" Runat="server" CommandName="Select"
    > CausesValidation="False" Text='<%# DataBinder.Eval(Container,
    > "DataItem.Status")%>' OnClick="lnkStatus_OnClick"/>
    > </ItemTemplate>
    > </asp:TemplateColumn>
    >
    > 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.
    >
    >
    >
     
    Karl Seguin, Apr 24, 2005
    #2
    1. Advertising

  3. George Durzi

    Madhuri.ssr

    Joined:
    Nov 30, 2011
    Messages:
    1
    use itemcommand property in the data grid then you can easily get it
     
    Madhuri.ssr, Nov 30, 2011
    #3
    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. Sathyaish
    Replies:
    3
    Views:
    3,113
    Sathyaish
    Sep 8, 2005
  2. jag
    Replies:
    0
    Views:
    590
  3. Sathyaish

    Linkbutton does not look like a linkbutton

    Sathyaish, Sep 8, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    189
    Sathyaish
    Sep 8, 2005
  4. Mike McAllister
    Replies:
    11
    Views:
    391
    Yan-Hong Huang[MSFT]
    Feb 21, 2006
  5. palmiere
    Replies:
    1
    Views:
    414
    Erwin Moller
    Feb 9, 2004
Loading...

Share This Page