<%@ Page Language="C#" AutoEventWireup="true" CodeFile="liaison_client.aspx.cs" Inherits="liaison_client" %>

<!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></title>
    <style type="text/css">
        .sys-template {display:none;visibility:hidden; }
    </style>
   <script language="javascript" type="text/javascript">         
    var ouvrageDataView = null;

    function afficherOuvrage() {
        LibrairieWebService.GetOuvrages(GetOuvragesComplete);
    }

    // fonction de réception
    function GetOuvragesComplete(result) {    
    // Ensure we have just one copy of the DataView.
    // The DataView's constructor gets a DOM reference to the template.
    if (ouvrageDataView === null)
        ouvrageDataView = new Sys.UI.DataView($get("ouvrageTable"));

    // Bind data to the template associated with the DataView
    ouvrageDataView.set_data(result);

    // Force the template to render 
    ouvrageDataView.refresh();    
     
//             $create(
//                   Sys.UI.DataView,
//                   {},
//                   {},
//                   {},
//                   $get("ouvrageTable")
//    );

    }
    
    </script>
</head>
<body xmlns:sys="javascript:Sys"
      xmlns:dataview="javascript:Sys.UI.DataView"
      >
    <form id="form1" runat="server">

    <asp:scriptmanager ID="Scriptmanager1" runat="server">
        <Services>
            <asp:ServiceReference Path="~/LibrairieWebService.asmx" />
        </Services> 
        <Scripts></Scripts>     
    </asp:scriptmanager>
     
    <div>
    <input type="button" onclick="afficherOuvrage()" value="Actualiser" />
    <table id="ouvrageTable" border="1" class="sys-template">         
        <tr>
          <td>{{Auteur}}</td>
          <td>{{Titre}}</td>          
        </tr>        
    </table>    
    </div>
    </form>
</body>
</html>
