asp.net ImageButton CommandArgument -
so have object playerlist of type list , doing foreach fill table. want add id of each player commandargument when click on imagebutton, know id of player need work with. reason not working. commandargument returning empty string yet collection has id when debug , each player.
<% foreach (var player in playerlist) { %> <tr> <td><asp:imagebutton width="32px" height="32px" commandargument='<%#eval("player.id")%>' id="editrecord" imageurl="../images/edit.png" oncommand="editrecord_click" runat="server" /></td> <td><%=player.firstname %></td> <td><%=player.lastname %></td> <td width="15%"><%=player.address %></td> <td><%=player.dob %></td> <td><%=player.parent1 %></td> <td><%=player.parent1phone %></td> <td><%=player.parent1email %></td> <td><%=player.parent2 %></td> <td><%=player.parent2phone %></td> <td><%=player.parent2email %></td> </tr> <%} %>
i figured out solution myself. instead of using foreach loop, added repeater.
Comments
Post a Comment