How to get Listview Data Key on Button Click

How to find a datakey value on image button click in listview without using any Listview event ???

Questions by Con2Vini   answers by Con2Vini

Showing Answers 1 - 1 of 1 Answers

shanaz fathima

  • Mar 5th, 2012

If you want to Get Data Key value on Click of ImageButton/LinkButton, you can set the DataKey value to CommandArgument property of your control and then in Click handler you can get the value from CommandArgument property

  1.  <asp:ImageButton ID="ibtn" runat="server" CommandArgument=<%# Eval("DataKeyName")%>

  2.  ImageUrl="~/Images/edit.png"></asp:ImageButton>


  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions