Default.aspx页面代码
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!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></title> </head> <body> <form id="form1" runat="server"> <div> </div> <asp:DataList ID="DataList1" runat="server" DataKeyField="CustomerID" RepeatColumns="3" RepeatDirection="Horizontal" DataSourceID="SqlDataSource1" CellPadding="4"
ForeColor="#333333" OnEditCommand="DataList1_EditCommand" OnCancelCommand="DataList1_CancelCommand"</span><span style="color: red">OnDeleteCommand</span><span style="color: blue">="DataList1_DeleteCommand"> <</span><span style="color: #a31515">FooterStyle </span><span style="color: red">BackColor</span><span style="color: blue">="#507CD1" </span><span style="color: red">Font-Bold</span><span style="color: blue">="True" </span><span style="color: red">ForeColor</span><span style="color: blue">="White" /> <</span><span style="color: #a31515">AlternatingItemStyle </span><span style="color: red">BackColor</span><span style="color: blue">="White" /> <</span><span style="color: #a31515">ItemStyle </span><span style="color: red">BackColor</span><span style="color: blue">="#EFF3FB" /> <</span><span style="color: #a31515">SelectedItemStyle </span><span style="color: red">BackColor</span><span style="color: blue">="#D1DDF1" </span><span style="color: red">Font-Bold</span><span style="color: blue">="True" </span><span style="color: red">ForeColor</span><span style="color: blue">="#333333" /> <</span><span style="color: #a31515">HeaderStyle </span><span style="color: red">BackColor</span><span style="color: blue">="#FF3399" </span><span style="color: red">Font-Bold</span><span style="color: blue">="True" </span><span style="color: red">ForeColor</span><span style="color: blue">="#FF99CC" </span><span style="color: red">Font-Italic</span><span style="color: blue">="False" </span><span style="color: red">Font-Overline</span><span style="color: blue">="False" </span><span style="color: red">Font-Strikeout</span><span style="color: blue">="False" </span><span style="color: red">Font-Underline</span><span style="color: blue">="False" /> <</span><span style="color: #a31515">ItemTemplate</span><span style="color: blue">> </span>CustomerID: <span style="color: blue"><</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">Label </span><span style="color: red">ID</span><span style="color: blue">="CustomerIDLabel" </span><span style="color: red">runat</span><span style="color: blue">="server" </span><span style="color: red">Text</span><span style="color: blue">='</span><span style="background: #ffee62"><%</span># Eval("CustomerID") <span style="background: #ffee62">%></span><span style="color: blue">' /> <</span><span style="color: #a31515">br </span><span style="color: blue">/> </span>CompanyName: <span style="color: blue"><</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">Label </span><span style="color: red">ID</span><span style="color: blue">="CompanyNameLabel" </span><span style="color: red">runat</span><span style="color: blue">="server" </span><span style="color: red">Text</span><span style="color: blue">='</span><span style="background: #ffee62"><%</span># Eval("CompanyName") <span style="background: #ffee62">%></span><span style="color: blue">' /> <</span><span style="color: #a31515">br </span><span style="color: blue">/> </span>ContactName: <span style="color: blue"><</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">Label </span><span style="color: red">ID</span><span style="color: blue">="ContactNameLabel" </span><span style="color: red">runat</span><span style="color: blue">="server" </span><span style="color: red">Text</span><span style="color: blue">='</span><span style="background: #ffee62"><%</span># Eval("ContactName") <span style="background: #ffee62">%></span><span style="color: blue">' /> <</span><span style="color: #a31515">br </span><span style="color: blue">/> </span>ContactTitle: <span style="color: blue"><</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">Label </span><span style="color: red">ID</span><span style="color: blue">="ContactTitleLabel" </span><span style="color: red">runat<<p class='post-footer'> original link: <a href='http://Apiaceae.github.io/blog/2009/10/18/DataList%E6%8E%A7%E4%BB%B6%E5%88%A0%E9%99%A4%E9%80%89%E4%B8%AD%E7%9A%84%E8%AE%B0%E5%BD%95/'>http://Apiaceae.github.io/blog/2009/10/18/DataList%E6%8E%A7%E4%BB%B6%E5%88%A0%E9%99%A4%E9%80%89%E4%B8%AD%E7%9A%84%E8%AE%B0%E5%BD%95/</a><br/> written by <a href='http://Apiaceae.github.io'>Hooker</a> posted at <a href='http://Apiaceae.github.io'>http://Apiaceae.github.io</a> </p>