datalist控件没有内置的分页功能,所以对于分页需自己写程序去实现;本示例还包括了DataList的所有基本操作,如添加,删除,修改,选择等;具体代码如下:
前台代码:Default.aspx
----------------------------------------
<%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="Example.DataListTest" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>DataListTest</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<style type="text/css">TD { FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: "宋体" }
</style>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td><a href="DlNested.aspx">DataList嵌套实例</a></td>
</tr>
<tr>
<td>
<table cellSpacing="0" borderColorDark="white" cellPadding="0" width="100%" align="center"
border="1">
<tr>
<td><asp:datalist id="DataList1" runat="server" Width="90%" Height="280px" RepeatColumns="2" RepeatDirection="Horizontal"
RepeatLayout="Flow">
<headertemplate>
<table id="Table6" cellspacing="0" bordercolordark="white" cellpadding="0" width="100%"
border="1">
<tr>
<td width="80%"><font face="宋体">TypeName</font></td>
<td width="50"><font face="宋体">选择</font></td>
<td width="50"><font face="宋体">确定</font></td>
<td width="50"><font face="宋体">删除</font></td>
</tr>
</table>
</headertemplate>
<selecteditemtemplate>
<font face="宋体">
<table id="Table3" cellspacing="0" cellpadding="0" width="100%" border="1" bordercolordark="white">
<tr>
<td><font face="宋体">TypeID</font></td>
<td><font face="宋体" color="#ff3366"><font face="宋体">TypeName</font></font></td>
</tr>
<tr>
&n