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

<!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>Wywołania zwrotne klienta</title>

   <script language="javascript" type="text/jscript">
   function CallBackReturnFunction(sReturnValue, oContext)
   {
      alert(sReturnValue);

      var oLocations = document.forms[0].lbLocation;
      var oOffices = document.forms[0].lbOffice;
       
      oLocations.length = 0;
      oOffices.length = 0;

      if (sReturnValue == '') return;

      var aLocations = sReturnValue.split('||');

      for (var i=0; i < aLocations.length; i++)
      {
         var aOptions = aLocations[i].split('|');
         oLocations.options[oLocations.length] = new Option( aOptions[1], aOptions[0]);
      }
   }
    
   function CallBackReturnFunction2(sReturnValue, oContext)
   {
      var oOffices = document.forms[0].lbOffice;
      oOffices.length = 0;
      if (sReturnValue == '') return;
      var aOffices = sReturnValue.split('||');
       
      for (var i=0; i < aOffices.length; i++)
      {
         var aOptions = aOffices[i].split('|');
         oOffices.options[oOffices.length] = new Option( aOptions[1], aOptions[0] );
      }
   }

   function OnError(exception, context)
   {
      alert(exception);
   }
   </script>
</head>
<body>
   <form id="form1" runat="server">
   <div>
   <table width="500" border="0" cellspacing="2" cellpadding="2">
      <tr>
         <th>Przedsiębiorstwo</th>
         <th>Lokalizacja</th>
         <th>Placówka</th>
      </tr>
      <tr>
         <td width="33%" valign="top">
            <asp:ListBox ID="lbCompany" runat="server" 
              OnClick="OnCompanyClick(this.options[this.selectedIndex].value);" />
         </td>
         <td width="33%" valign="top">
            <asp:ListBox ID="lbLocation" runat="server"
              OnClick="OnLocationClick(this.options[this.selectedIndex].value);" />
         </td>
         <td width="33%" valign="top">
            <asp:ListBox ID="lbOffice" runat="server"></asp:ListBox>
         </td>
      </tr>
      <tr>
         <td colspan="3" align="right">
            <asp:Button ID="btnSubmit" runat="server" Text="Pokaż szczegóły dotyczące placówki" />
         </td>
      </tr>
   </table>
   </div>
   </form>
</body>
</html>
