I need to identify the row of the button click.Button is added dynamically throught a data repeater
@for (int i = 0; i < Model.lstUPC.Count; i++)
{
<div class="col-md-1 addDelete">
<input type="submit" value="+" class="form-control" name="UPCRowAdd" id="MPNet" />
</div>
<div class="col-md-1 addDelete">
<input type="submit" value="-" class="form-control" name="UPCRowAdd" id="MPNet" />
</div>
}
Controller code
[HttpPost]
public ActionResult ItemSetup(ItemSetupModel itemSetupModel, string UPCRowAdd, string command)
{
string queryString = string.Empty;
if (UPCRowAdd == "+")
{
UPC upc = new UPC();
itemSetupModel.lstUPC.Add(upc);
}
}
Model code
namespace PricingUpdates.Models
{
public class UPC
{
public string ItemNumberForUPC { get; set; }
public string GCOwner { get; set; }
public string GCFeeItem { get; set; }
public string GCBranded { get; set; }
public string query { get; set; }
}
public class ItemSetupModel
{
public StoreSelectionModel storeSelectionForUPC { get; set; }
public List<UPC> lstUPC { get; set; }
}
}
I have the button being generated dynamically ie based on the lstUPCCount(a list).Now whenever a button is clicked i need to identify which position or the index of the button clicked.How can i identify that.