Two Select LinkButton's in DataGrid

G

George Durzi

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.
 
K

Karl Seguin

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

Karl
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top