I created a div with a ListView where CheckBox and a Image in> Page_Load .
I need to click on one of the CheckBox by selecting from the image, it will be created dynamically in another Div , and at most the user can select 4 images from the list and after choosing the images they are saved the path of the folder so that another time the user enters the same screen the previously selected images will be loaded.
Below what I already have.
<asp:Panel runat="server" ID="panelObjeto">
<div style="position: relative; height: 300px; width: 200px; overflow-x: scroll;">
<asp:ListView ID="livImagens" runat="server" OnSelectedIndexChanging="livImagens_OnSelectedIndexChanged">
<LayoutTemplate>
<table>
<tr>
<th></th>
</tr>
<tr id="itemplaceholder" runat="server">
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr style="border: solid 1px">
<td style="border: solid 1px">
<asp:CheckBox ID="cbxImagem" runat="server" />
</td>
<td>
<asp:Image ID="Image1" runat="server" Height="100px" Width="100px" ImageUrl='<%# Eval("Value") %>' />
</td>
</tr>
</ItemTemplate>
</asp:ListView>
</div>
<div id="divimagens" runat="server" style="position: absolute; left: 35%; top: 23%; height: 300px; width: 710px;">
<p>Aqui será carregado as imagens</p>
</div>
</asp:Panel>
Code behind.
if (!IsPostBack)
{
string[] filePaths = Directory.GetFiles(Server.MapPath("~/Imagens/"));
List<ListItem> files = new List<ListItem>();
foreach (string filePath in filePaths)
{
string fileName = Path.GetFileName(filePath);
files.Add(new ListItem(fileName, "~/Imagens/" + fileName));
}
livImagens.DataSource = files;
livImagens.DataBind();
}