前台代码:
<asp:DataList ID="DLrefinement" DataKeyField ="BookID" runat="server" RepeatColumns="3" RepeatDirection="Horizontal" OnItemCommand="DLrefinement_ItemCommand" CellPadding="4" ForeColor="#333333"
Width="540px">
<ItemTemplate>
<table align="left" cellpadding=0 cellspacing=0 style =" width :135px; height:158px;" >
<tr align =center style =" width :135px; height:65px;" >
<td colspan="2" align="center" >
<asp:Image ID="imageRefine" Width=70px Height=100px runat="server" ImageUrl =<%#DataBinder.Eval(Container.DataItem,"BookUrl")%>/></td>
</tr>
<tr align =center valign =bottom style =" width :135px; height:11px; font-size: 9pt; font-family: 宋体;">
<td colspan="2" align="center">
<%#DataBinder.Eval(Container.DataItem, "BookName")%>
</td>
</tr>
<tr align =center valign =bottom style =" width :135px; height:11px; font-size: 9pt; font-family: 宋体;">
<td align="center" >
市场价格</td>
<td align="left" >
¥ <%#GetMkprice(DataBinder.Eval(Container.DataItem, "Marketprice", "{0:f2}").ToString())%>
</td>
</tr>
<tr align =center valign =bottom style =" width :135px; height:11px;font-size: 9pt; font-family: 宋体;">
<td align="center" >
会员价格</td>
<td align="left" >
¥ <%#GetMeberprice(DataBinder.Eval(Container.DataItem, "MemberPrice", "{0:f2}").ToString())%>
</td>
</tr>
<tr align =left valign =bottom style =" width :135px; height:11px;font-size: 9pt; font-family: 宋体;">
<td colspan="2" align="center" >
<asp:ImageButton ID="btndetafil" runat="server" ImageUrl="~/Image/btn_detail.gif" CommandName="detailsee" />
<asp:ImageButton ID="btnbuy" runat="server" ImageUrl="~/Image/btn_buy.gif" CommandName="buybook" CommandArgument ='<%# DataBinder.Eval(Container.DataItem, "BookID") %>'/>
</td>
</tr>
</table>
</ItemTemplate>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<SelectedItemStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<AlternatingItemStyle BackColor="White" />
<ItemStyle BackColor="#EFF3FB" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
</asp:DataList>
后台代码:
protected void DLrefinement_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "detailsee")
{
Session["address"] = "";
Session["address"] = "index.aspx";
Response.Redirect("~/User/showgoodsInfo.aspx?BookID=" + Convert.ToInt32(DLrefinement.DataKeys[e.Item.ItemIndex].ToString()));
}
else if(e.CommandName=="buybook")
{
AddShopCart(e);
}
}
高手帮忙解决下,如果解决了,可以加分
<asp:DataList ID="DLrefinement" DataKeyField ="BookID" runat="server" RepeatColumns="3" RepeatDirection="Horizontal" OnItemCommand="DLrefinement_ItemCommand" CellPadding="4" ForeColor="#333333"
Width="540px">
<ItemTemplate>
<table align="left" cellpadding=0 cellspacing=0 style =" width :135px; height:158px;" >
<tr align =center style =" width :135px; height:65px;" >
<td colspan="2" align="center" >
<asp:Image ID="imageRefine" Width=70px Height=100px runat="server" ImageUrl =<%#DataBinder.Eval(Container.DataItem,"BookUrl")%>/></td>
</tr>
<tr align =center valign =bottom style =" width :135px; height:11px; font-size: 9pt; font-family: 宋体;">
<td colspan="2" align="center">
<%#DataBinder.Eval(Container.DataItem, "BookName")%>
</td>
</tr>
<tr align =center valign =bottom style =" width :135px; height:11px; font-size: 9pt; font-family: 宋体;">
<td align="center" >
市场价格</td>
<td align="left" >
¥ <%#GetMkprice(DataBinder.Eval(Container.DataItem, "Marketprice", "{0:f2}").ToString())%>
</td>
</tr>
<tr align =center valign =bottom style =" width :135px; height:11px;font-size: 9pt; font-family: 宋体;">
<td align="center" >
会员价格</td>
<td align="left" >
¥ <%#GetMeberprice(DataBinder.Eval(Container.DataItem, "MemberPrice", "{0:f2}").ToString())%>
</td>
</tr>
<tr align =left valign =bottom style =" width :135px; height:11px;font-size: 9pt; font-family: 宋体;">
<td colspan="2" align="center" >
<asp:ImageButton ID="btndetafil" runat="server" ImageUrl="~/Image/btn_detail.gif" CommandName="detailsee" />
<asp:ImageButton ID="btnbuy" runat="server" ImageUrl="~/Image/btn_buy.gif" CommandName="buybook" CommandArgument ='<%# DataBinder.Eval(Container.DataItem, "BookID") %>'/>
</td>
</tr>
</table>
</ItemTemplate>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<SelectedItemStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<AlternatingItemStyle BackColor="White" />
<ItemStyle BackColor="#EFF3FB" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
</asp:DataList>
后台代码:
protected void DLrefinement_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "detailsee")
{
Session["address"] = "";
Session["address"] = "index.aspx";
Response.Redirect("~/User/showgoodsInfo.aspx?BookID=" + Convert.ToInt32(DLrefinement.DataKeys[e.Item.ItemIndex].ToString()));
}
else if(e.CommandName=="buybook")
{
AddShopCart(e);
}
}
高手帮忙解决下,如果解决了,可以加分
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货