62,254
社区成员
发帖
与我相关
我的任务
分享
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
DataKeyNames="ID" DataSourceID="LinqDataSource1" ForeColor="#333333" GridLines="None"
Height="225px" Width="403px" OnRowDataBound="GridView1_RowDataBound">
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:CommandField EditText="更改数量" ShowDeleteButton="True" ShowEditButton="True" UpdateText="确认" />
<asp:BoundField DataField="BookID" HeaderText="书名" ReadOnly="True" SortExpression="BookID" />
<asp:BoundField DataField="SumPrice" HeaderText="单价" ReadOnly="True" SortExpression="SumPrice" />
<asp:BoundField DataField="Num" HeaderText="数量" SortExpression="Num" />
<asp:TemplateField HeaderText="总价">
<ItemTemplate>
<%# (decimal)Eval("单价") * (double)Eval("数量") %>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:Label runat="server" Text='<%# (decimal)Eval("单价") * (double)Eval("数量") %>' /><asp:Label runat="server" Text='<% (decimal)Eval("单价") * (double)Eval("数量") %>' />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
CellPadding="4" DataKeyNames="ID" DataSourceID="LinqDataSource1"
ForeColor="#333333" GridLines="None" Height="225px" Width="403px" onrowdatabound="GridView1_RowDataBound"
>
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:CommandField EditText="更改数量" ShowDeleteButton="True" ShowEditButton="True"
UpdateText="确认" />
<asp:BoundField DataField="BookID" HeaderText="书名" ReadOnly="True"
SortExpression="BookID" />
<asp:BoundField DataField="SumPrice" HeaderText="单价" ReadOnly="True"
SortExpression="SumPrice" />
<asp:BoundField DataField="Num" HeaderText="数量" SortExpression="Num" />
<asp:TemplateField HeaderText="总价"></asp:TemplateField>
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>