I have minimal knowledge of ASP.Net WebForms. Now I am facing a small issue. Here I am iterating list using foreach, while iterating I want to bind value linkbutton command argument. But OnCommand event I am not getting value.
MyCode:
.aspx
<%foreach (var item in model.ItemsWithoutDiscount) {%>
<asp:Button ID="Button1" runat="server" Text="Delete" CommandArgument='<%= item.ID %>' OnCommand="Button1_Click" />
<%}%>
This is my event on .aspx.cs
protected void Button1_Click(Object sender, CommandEventArgs e)
{
string ID = e.CommandArgument.ToString();
}
I want pass value in command argument to my event. Please help
