<%@ Page Language="C#" AutoEventWireup="true" CodeFile="repeater-normal.aspx.cs" Inherits="repeater_normal" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style>
table,tr,td{
border:1px solid black;
}
th{
font-size:14px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Repeater ID="rptMembers" runat="server">
<HeaderTemplate>
<table>
<tr>
<th>FULLNAME</th>
<th>CITY</th>
<th>PHONE NUMBER</th>
<th>EMAIL ID</th>
<th>WEB SITE</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:lightblue;">
<td><%# Eval("FullName") %></td>
<td><%# Eval("City") %></td>
<td><%# Eval("PhoneNumber") %></td>
<td><%# Eval("EmailID") %></td>
<td><%# Eval("WebSite") %></td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr style="background-color:lightgray;">
<td><%# Eval("FullName") %></td>
<td><%# Eval("City") %></td>
<td><%# Eval("PhoneNumber") %></td>
<td><%# Eval("EmailID") %></td>
<td><%# Eval("WebSite") %></td>
</tr>
</AlternatingItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class repeater_normal : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
FriendDataClassesDataContext db = new FriendDataClassesDataContext();
var MemberList = (from a in db.dbMembers select a).ToList();
rptMembers.DataSource = MemberList;
rptMembers.DataBind();
}
}
No comments:
Post a Comment