代码如下:<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data" %><!-- 声明一个 DataList 控件,作为"购书篮" -->
<asp:DataList id="ShoppingCart" HorizontalAlign="center" RepeatColumns="1"
OnItemCommand="Cart_Remove" runat="server">
<template Name="HeaderTemplate">
<center><font color="linen" Size=+2><b>购书篮</b></font></center>
<hr width="260" color="MidnightBlue">
</template>
<!--定义项目模板-->
<template name="ItemTemplate">
<table CellSpacing="2" Align="Center" style="color:Gold" width="260">
<tr>
<td width="50%" style="color:Lavender">书名:
<asp:Label id="lblTitle" ForeColor="Gold" runat="server"
text='<% # DataBinder.Eval(Container.DataItem,"书名") %>'/>
</td>
<td width="38%" style="color:Lavender">单价:
<asp:Label id="lblPrice" ForeColor="Gold" runat="server"
text='<% # DataBinder.Eval(Container.DataItem,"单价") %>'/>
</td>
<td>
<asp:LinkButton id="lbtnEdit" runat="server"
Text="移出" Commandname="Remove" />
</td>
</tr>
<tr>
<td width="50%" style="color:Lavender">购买数量:
<asp:TextBox id="txtQuantity" width="30" height="18" runat="server"
text='<% # DataBinder.Eval(Container.DataItem,"数量") %>'/>
</td>
<td width="38%" style="color:Lavender">总价:
<asp:label id="lblItemTotal" ForeColor="Gold" runat="server" text=
'<% # DataBinder.Eval(Container.DataItem,"总价","{0:c}") %>'/>
</td>
</tr>
</table>
</template>
<!--定义分隔符模板-->
<template name="SeparatorTemplate">
<hr>
</template>
<!--定义脚注模板-->
<template name="FooterTemplate">
<hr width="260" color="MidnightBlue">
</template>
</asp:DataList><asp:Panel id="CheckoutPanel" ruanat="server" width="260"
HorizontalAlign="Center" BackColor="Moccasin">
<br><b>总金额:</b>
<asp:label id="lblSubTotal" ForeColor="DarkRed" runat="server" />
<p><asp:LinkButton id="btnRecalculate" runat="server"
Text='重新汇总' OnClick="btnRecalculate_Click"/>
<asp:LinkButton id="btnCheckOut" runat="server"
Text='结账' OnClick="btnCheckOut_Click"/>
<asp:LinkButton id="btnClearCart" runat="server"
Text='清空购书篮' OnClick="btnClearCart_Click"/>
<p><asp:label id="lblCheckOut" FireColor="DarkRed" runat="server"/>
</asp:Panel>系统报:Parser Error Message: Type 'System.Web.UI.WebControls.DataList' does not have a property named 'template'.
<%@ Import Namespace="System.Data" %><!-- 声明一个 DataList 控件,作为"购书篮" -->
<asp:DataList id="ShoppingCart" HorizontalAlign="center" RepeatColumns="1"
OnItemCommand="Cart_Remove" runat="server">
<template Name="HeaderTemplate">
<center><font color="linen" Size=+2><b>购书篮</b></font></center>
<hr width="260" color="MidnightBlue">
</template>
<!--定义项目模板-->
<template name="ItemTemplate">
<table CellSpacing="2" Align="Center" style="color:Gold" width="260">
<tr>
<td width="50%" style="color:Lavender">书名:
<asp:Label id="lblTitle" ForeColor="Gold" runat="server"
text='<% # DataBinder.Eval(Container.DataItem,"书名") %>'/>
</td>
<td width="38%" style="color:Lavender">单价:
<asp:Label id="lblPrice" ForeColor="Gold" runat="server"
text='<% # DataBinder.Eval(Container.DataItem,"单价") %>'/>
</td>
<td>
<asp:LinkButton id="lbtnEdit" runat="server"
Text="移出" Commandname="Remove" />
</td>
</tr>
<tr>
<td width="50%" style="color:Lavender">购买数量:
<asp:TextBox id="txtQuantity" width="30" height="18" runat="server"
text='<% # DataBinder.Eval(Container.DataItem,"数量") %>'/>
</td>
<td width="38%" style="color:Lavender">总价:
<asp:label id="lblItemTotal" ForeColor="Gold" runat="server" text=
'<% # DataBinder.Eval(Container.DataItem,"总价","{0:c}") %>'/>
</td>
</tr>
</table>
</template>
<!--定义分隔符模板-->
<template name="SeparatorTemplate">
<hr>
</template>
<!--定义脚注模板-->
<template name="FooterTemplate">
<hr width="260" color="MidnightBlue">
</template>
</asp:DataList><asp:Panel id="CheckoutPanel" ruanat="server" width="260"
HorizontalAlign="Center" BackColor="Moccasin">
<br><b>总金额:</b>
<asp:label id="lblSubTotal" ForeColor="DarkRed" runat="server" />
<p><asp:LinkButton id="btnRecalculate" runat="server"
Text='重新汇总' OnClick="btnRecalculate_Click"/>
<asp:LinkButton id="btnCheckOut" runat="server"
Text='结账' OnClick="btnCheckOut_Click"/>
<asp:LinkButton id="btnClearCart" runat="server"
Text='清空购书篮' OnClick="btnClearCart_Click"/>
<p><asp:label id="lblCheckOut" FireColor="DarkRed" runat="server"/>
</asp:Panel>系统报:Parser Error Message: Type 'System.Web.UI.WebControls.DataList' does not have a property named 'template'.
解决方案 »
- 大家帮我完善一下,自动生成sql语句方法
- RequiredFieldValidator问题
- VS2005环境下,用JavaScript调用WebService的成功例子。
- -----小小的一个图表控件,不成敬意,欢迎大家提出宝贵意见,
- 怎么样在ASP.NET里实现msgbox的功能啊???(VB.NET)
- mysql在ASP。NET里怎么备份 恢复
- 怎么分别控制各个验证控件?!!
- 将时间格式的数据从hashtable读到dt里遇到的问题
- ckfinder整合进ckeditor无法使用浏览服务器功能,弹出空白页面
- 请问各位大虾能不能在 类中实现“response”、“request”
- 超级郁闷的两个问题,在一起提了.
- 请问我怎么写数据库链接字符!
runat="server">
<HeaderTemplate>
123
</HeaderTemplate>
<SelectedItemTemplate>
asd
</SelectedItemTemplate>
<FooterTemplate>
123
</FooterTemplate>
<ItemTemplate>
asd
</ItemTemplate>
<SeparatorTemplate>
123
</SeparatorTemplate>
<AlternatingItemTemplate>
asd
</AlternatingItemTemplate>
<EditItemTemplate>
asd
</EditItemTemplate>
</asp:DataList>