<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Listing16-15.aspx.cs"
	Inherits="Listing16_15" %>
<!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>Vpis 16.15</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<br />Country:&nbsp;
<asp:DropDownList ID="ddlCountries" runat="server"
AutoPostBack="True" DataSourceID="countriesDataSource"
DataTextField="Country" DataValueField="Country" />
<br />
<asp:ListView ID="customersList" runat="server"
DataSourceID="customersDataSource">
<LayoutTemplate>
<table cellpadding="5" cellspacing="0" border="1">
<tr>
<th style="text-align: center">CustomerId</th>
<th style="text-align: center">CompanyName</th>
<th style="text-align: center">ContactName</th>
<th style="text-align: center">Country</th>
</tr>
<asp:PlaceHolder ID="itemPlaceholder" runat="server" />
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td style="text-align: center">
<asp:Label ID="Label1" runat="server"
	Text='<%# Eval("CustomerId") %>' />
</td>
<td style="text-align: center">
<asp:Label ID="Label2" runat="server"
	Text='<%# Eval("CompanyName") %>' />
</td>
<td style="text-align: center">
<asp:Label ID="Label3" runat="server"
		Text='<%# Eval("ContactName") %>' />
</td>
<td style="text-align: center">
<asp:Label ID="Label4" runat="server"
	Text='<%# Eval("Country") %>' />
</td>
</tr>
</ItemTemplate>
</asp:ListView>
<asp:LinqDataSource ID="customersDataSource" runat="server"
ContextTypeName="NorthwindDataContext"
Select="new (CustomerID, CompanyName, ContactName, Country)"
TableName="Customers" Where="Country == @Country">
<WhereParameters>
<asp:ControlParameter ControlID="ddlCountries"
Name="Country" PropertyName="SelectedValue"
Type="String" />
</WhereParameters>
</asp:LinqDataSource>
<asp:DataPager ID="customersPager" PagedControlID="customersList"
runat="server" PageSize="5">
<Fields>
	<asp:NumericPagerField ButtonCount="5" ButtonType="Link" />
</Fields>
</asp:DataPager>
<br />
<asp:LinqDataSource ID="countriesDataSource" runat="server"
ContextTypeName="NorthwindDataContext" GroupBy="Country"
OrderGroupsBy="key" Select="new (key as Country)"
TableName="Customers">
</asp:LinqDataSource>
</div>
</form>
</body>
</html>
