我的源码如下<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ProductDetail.aspx.cs" Inherits="ProductDetail" %><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
DataSourceID="SqlDataSource_Cart" Height="50px" Width="145px"
DataKeyNames="ProductId">
<EmptyDataTemplate>
没有数据
</EmptyDataTemplate>
<Fields>
<asp:BoundField DataField="Name" HeaderText="名称" SortExpression="Name" />
<asp:ImageField DataImageUrlField="Image" HeaderText="图片">
</asp:ImageField>
<asp:BoundField DataField="Descn" HeaderText="简介" SortExpression="Descn" />
<asp:BoundField DataField="ListPrice" HeaderText="单价"
SortExpression="ListPrice" DataFormatString="{0:c}" />
</Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource_Cart" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [ProductId], [CategoryId], [Name], [Descn], [Image], [ListPrice] FROM [Product] WHERE ([ProductId] = @ProductId)" onselecting="SqlDataSource_Cart_Selecting"
>
<SelectParameters>
<asp:QueryStringParameter Name="ProductId" QueryStringField="ProductId"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</asp:Content>
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
DataSourceID="SqlDataSource_Cart" Height="50px" Width="145px"
DataKeyNames="ProductId">
<EmptyDataTemplate>
没有数据
</EmptyDataTemplate>
<Fields>
<asp:BoundField DataField="Name" HeaderText="名称" SortExpression="Name" />
<asp:ImageField DataImageUrlField="Image" HeaderText="图片">
</asp:ImageField>
<asp:BoundField DataField="Descn" HeaderText="简介" SortExpression="Descn" />
<asp:BoundField DataField="ListPrice" HeaderText="单价"
SortExpression="ListPrice" DataFormatString="{0:c}" />
</Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource_Cart" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [ProductId], [CategoryId], [Name], [Descn], [Image], [ListPrice] FROM [Product] WHERE ([ProductId] = @ProductId)" onselecting="SqlDataSource_Cart_Selecting"
>
<SelectParameters>
<asp:QueryStringParameter Name="ProductId" QueryStringField="ProductId"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</asp:Content>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货