<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<IEnumerable<r14.Models.ListItem>>" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>List</title>
    <link rel="Stylesheet" href="../../Content/site.css" />
</head>
<body>
<h2>Lista bułek</h2> 
<div id="message"></div>
<ul> 
    <% foreach (var item in Model) { %> 
        <li id="item_<%: item.ItemID %>"> 
            <b><%: item.Name %></b> 
            <%: Ajax.ActionLink("Usuń", "DeleteItem", new {item.ItemID}, null) %> 
        </li>             
    <% } %> 
</ul> 
<i>Strona ta została wygenerowana o godzinie <%: DateTime.Now.ToLongTimeString() %></i>


    <script type="text/javascript"  
            src="<%: Url.Content("~/Scripts/MicrosoftAjax.js") %>"></script> 
    <script type="text/javascript"  
            src="<%: Url.Content("~/Scripts/MicrosoftMvcAjax.js") %>"></script>    

<script type="text/javascript"> 
    function OnItemDeleted(id, name) {
        document.getElementById("message").innerHTML = "Bułka " + name + " została usunięta";
        var deletedNode = document.getElementById("item_" + id); 
        deletedNode.parentNode.removeChild(deletedNode); 
    } 
</script> 


</body>
</html>

