如何使用DataList,书上讲的太少,加上我刚学这个控件,一点都不明白其中的原理,望高手指教

来源:百度知道 编辑:UC知道 时间:2024/05/11 19:41:34
如有电子书下载链接也行!!!

dataList就是循环里面的数据,直到结束,一般是从数据库中查询出的数据,
this.DataList1.DataSource = (从数据库查询数据,返回dataSet);
再进行绑定.
this.DataList1.DataBind();

就可以使用它了。如:下面内容
<asp:DataList ID="DataList1" runat="server"
RepeatColumns="1" RepeatDirection="Horizontal" EnableViewState="False">
<ItemTemplate>
<table width="100%" class="table-xia" border="0" cellspacing="0" cellpadding="10" align="center">
<tr>
<td width="20%" rowspan="4" class="table-you" align="center"><TABLE onmouseover="this.style.backgroundColor='#FF6600'" onmouseout="this.style.backgroundColor=''" width=100 height=100 cellSpacing=1 cellPadding=2 bgColor=#e1e1e1 border=0>