Link to home
Create AccountLog in
Avatar of Relegence
RelegenceFlag for Israel

asked on

Using a LinkButton in a gridView column

Hello,

I am using a LinkButton in a GridView I am using. In the same column there is also a label.

<asp:TemplateField HeaderText="Computer">
<ItemTemplate>
  <label id="lblComputerName" runat="server" style="cursor:hand;">
  <%# DataBinder.Eval(Container, "DataItem.computerName")%>
</label>
<asp:Panel CssClass="popupMenu" ID="PopupMenu" runat="server">
  <div style="border:1px outset red;padding:2px;width:100px">
  <div><asp:LinkButton ID="lnkStart" Enabled="false" runat="server" OnClick="StartApp"     CommandName="Start" Text="Start" /></div>
<div><asp:LinkButton ID="lnkStop" runat="server" OnClick="StopApp" CommandName="Stop" Text="Stop" /></div>
</div>
</asp:Panel>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Computer ID">
<ItemTemplate>
  <asp:Label runat="server" ID="lblComputerID" CssClass="linkcursor" Text='<%# DataBinder.Eval(Container, "DataItem.computerID") %>'>
  </asp:Label>
  </ItemTemplate>
</asp:TemplateField>

When a linkButton is clicked, I'd like to know on which row it was clicked. Actualy, the information i need is the Value in the ComputerID column in the same row.
How can I get it?

Thank you
ASKER CERTIFIED SOLUTION
Avatar of skiltz
skiltz
Flag of New Zealand image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Relegence

ASKER

Where do I set the datakeynames? Can you please give an example?
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.