这是gridview部分。有人请帮我找到答案。我希望将Count
和Price
相乘,并在Amount
中显示总和。
<asp:TemplateField HeaderText="Price">
<ItemTemplate>
<asp:Label ID="lblCardPrice" runat="server" Text='<%# Bind("Price")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Count" >
<ItemTemplate>
<asp:Label ID="lblCount" runat="server" Text='<%# Bind("Count")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Amount">
<ItemTemplate>
<asp:Label ID="lblAmount" runat="server" Text='<%# Eval("(Amount)")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
答案 0 :(得分:0)
试试这个:
<asp:TemplateField HeaderText="Amount" >
<ItemTemplate >
<asp:Label ID="lblAmount" runat="server" Text='<%# Convert.ToInt32(Eval("Count"))*Convert.ToInt32(Eval("Price"))%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>