I am making a page where all the images are retriaved from the server/database, and shown on the page. For this I use AJAX. The code below retrieves an array with references to images, and an index. From that info I line up the images. What I want to do, is to give the user the possibility to delete chosen images. These images should be chosen through a checkbox. My problem is that I don't know how to add a checkbox (below the image) so that it corresponds to each image, and also find that checked value in the C# code. I will need to find it, since I have to find the checked image in the database and delete it. Does anyone know how to do this? Normally to find an ID in the C# code, we apply the runat="server" on the aspx page, but this time, the IDs are added dynamically, and with JS code.
function loadImage(array, index) {
for (i = 0; i < array.length; i++) {
$("#parentDiv").append("<span style='padding-left: 10px; margin-top: 5px;' id='span_" + i + "'></span>");
$("#span_" + i + "").append("<img style='width: 100px; height: 90px;' id='img_"+i+"' src='" + array[index] + "' />");
index++;
}
}