ListViewItemSeparatorTemplate.aspx
<%@ Page Language="C#" AutoEventWireup="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>ListView ItemSeparatorTemplate - how to use ItemSeparatorTemplate</title>
<style type="text/css">
.ContainerTableCSS
{
background-color:OrangeRed;
width: 725px;
}
.TableHeader
{
background-color:OrangeRed;
color:Snow;
font-size:large;
font-family:Times New Roman;
height:45px;
text-align:center;
}
.ItemCSS
{
background-color:DarkOrange;
color:Snow;
font-family:MS Sans Serif;
font-size:medium;
font-weight:bold;
height:28px;
}
.ItemSeparatorCSS
{
background-color:Orange;
height:2px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:SeaGreen; font-style:italic;">ListView Example: How To Use ItemSeparatorTemplate</h2>
<hr width="625" align="left" color="Green" />
<asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="Select Top 10 ProductID, ProductName, UnitPrice From products Order By ProductID"
>
</asp:SqlDataSource>
<br />
<asp:ListView
ID="ListView1"
runat="server"
DataSourceID="SqlDataSource1"
DataKeyNames="ProductID"
>
<LayoutTemplate>
<table id="Table1" runat="server" class="ContainerTableCSS">
<tr id="Tr1" runat="server" class="TableHeader">
<td id="Td1" runat="server">Product ID</td>
<td id="Td2" runat="server">Product Name</td>
<td id="Td3" runat="server">Unite Price</td>
</tr>
<tr id="ItemPlaceholder" runat="server">
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr class="ItemCSS">
<td>
<asp:Label
ID="Label1"
runat="server"
Text='<%# Eval("ProductID")%>'
>
</asp:Label>
</td>
<td>
<asp:Label
ID="Label2"
runat="server"
Text='<%# Eval("ProductName")%>'
>
</asp:Label>
</td>
<td>
<asp:Label
ID="Label3"
runat="server"
Text='<%# Eval("UnitPrice")%>'
>
</asp:Label>
</td>
</tr>
</ItemTemplate>
<ItemSeparatorTemplate>
<tr>
<td colspan="3" class="ItemSeparatorCSS"></td>
</tr>
</ItemSeparatorTemplate>
</asp:ListView>
</div>
</form>
</body>
</html>
No comments:
Post a Comment