<%@ Page Language="C#" %>

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

<script runat="server">

  protected void Page_Load(object sender, EventArgs e)
  {
    CurrentTime.Text = DateTime.Now.ToLongTimeString();
  }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
  <title>ASP.NET AJAX</title>
</head>
<body>
  <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:Label ID="CurrentTime" runat="server" />
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
      <ContentTemplate>
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True"
          AutoGenerateColumns="False" DataKeyNames="VendorID"
DataSourceID="SqlDataSource1"
          EmptyDataText="Brak danych do wyświetlenia.">
          <Columns>
            <asp:CommandField ShowEditButton="True" CancelText="Anuluj" DeleteText="Usuń" 
                  EditText="Edytuj" UpdateText="Uaktualnij" />
            <asp:BoundField DataField="VendorID" HeaderText="VendorID"
ReadOnly="True" SortExpression="VendorID" />
            <asp:BoundField DataField="AccountNumber" HeaderText="AccountNumber"
SortExpression="AccountNumber" />
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name"
/>
            <asp:BoundField DataField="CreditRating" HeaderText="CreditRating"
SortExpression="CreditRating" />
            <asp:CheckBoxField DataField="PreferredVendorStatus"
HeaderText="PreferredVendorStatus"
              SortExpression="PreferredVendorStatus" />
            <asp:CheckBoxField DataField="ActiveFlag" HeaderText="ActiveFlag"
SortExpression="ActiveFlag" />
            <asp:BoundField DataField="PurchasingWebServiceURL"
HeaderText="PurchasingWebServiceURL"
              SortExpression="PurchasingWebServiceURL" />
            <asp:BoundField DataField="ModifiedDate" HeaderText="ModifiedDate"
SortExpression="ModifiedDate" />
          </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:AdventureWorksConnectionString1 %>"
          DeleteCommand="DELETE FROM [Purchasing].[Vendor] WHERE [VendorID] =
@VendorID"
          ProviderName="<%$ ConnectionStrings:AdventureWorksConnectionString1.ProviderName %>"
          SelectCommand="SELECT [VendorID], [AccountNumber], [Name], [CreditRating],
[PreferredVendorStatus], [ActiveFlag], [PurchasingWebServiceURL], [ModifiedDate]
FROM [Purchasing].[Vendor]"
          UpdateCommand="UPDATE [Purchasing].[Vendor] SET [AccountNumber] =
@AccountNumber, [Name] = @Name, [CreditRating] = @CreditRating,
[PreferredVendorStatus] = @PreferredVendorStatus, [ActiveFlag] = @ActiveFlag,
[PurchasingWebServiceURL] = @PurchasingWebServiceURL, [ModifiedDate] =
@ModifiedDate WHERE [VendorID] = @VendorID">
          <UpdateParameters>
            <asp:Parameter Name="AccountNumber" Type="String" />
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="CreditRating" Type="Byte" />
            <asp:Parameter Name="PreferredVendorStatus" Type="Boolean" />
            <asp:Parameter Name="ActiveFlag" Type="Boolean" />
            <asp:Parameter Name="PurchasingWebServiceURL" Type="String" />
            <asp:Parameter Name="ModifiedDate" Type="DateTime" />
            <asp:Parameter Name="VendorID" Type="Int32" />
          </UpdateParameters>
          <DeleteParameters>
            <asp:Parameter Name="VendorID" Type="Int32" />
          </DeleteParameters>
        </asp:SqlDataSource>
      </ContentTemplate>
    </asp:UpdatePanel>
  </form>
</body>
</html>
