1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| @{
ViewBag.Title = "Telecharger des images";
}
<h3>Télecharger des images</h3>
<p></p>
<p>
@using (Html.BeginForm("Upload", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input type="file" name="image" />
<input type="submit" value="Télecharger" />
}
</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="150px" valign="top" align="center" style="border-right:3px solid #EEEEEE">
<div id="ImageGallery" style="overflow:auto; height:500px; width:130px; display:inline-block;">
<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
@foreach (var item in Model)
{
<img src="@item" alt="Image" width="100" height="100" style="cursor:pointer" />
<a id="@item" href="#" onclick="DeleteImage('@item');">X</a>
}
</ItemTemplate>
</asp:Repeater>
</div>
</td>
<td valign="top" align="center">
<img id="bigImage" alt="bigImage" width="500" height="500" />
</td>
</tr>
</table>
<script src="Scripts/jquery-1.7.1.js"></script>
<script>
function DeleteImage(item) {
var url = "/Home/DeleteImage";
$.post(url, { Name: item }, function (data) {
window.location.href = "/Home/Upload";
});
}
</script> |
Partager