Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 如何使用vb.net将两列相乘并在gridview的另一列中显示_Asp.net_Vb.net_Gridview - Fatal编程技术网

Asp.net 如何使用vb.net将两列相乘并在gridview的另一列中显示

Asp.net 如何使用vb.net将两列相乘并在gridview的另一列中显示,asp.net,vb.net,gridview,Asp.net,Vb.net,Gridview,这是gridview部分。有人请帮我找到答案。我想将计数和价格相乘,并在金额中显示总和 <asp:TemplateField HeaderText="Price"> <ItemTemplate> <asp:Label ID="lblCardPrice" runat="server" Text='<%# Bind("Price")%>'></asp:Label> </ItemTemplate>

这是gridview部分。有人请帮我找到答案。我想将
计数
价格
相乘,并在
金额
中显示总和

<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>

试试这个:

<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>

我发布了答案,试试看