本文介绍了如何在GridView中将速率和数量列相乘并在总点列中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<asp:GridView ID="GridView1" runat="server" ShowHeaderWhenEmpty="true" 

            BorderWidth="3px" CellPadding="2" BorderStyle="Groove"

            

            style="z-index: 1; left: 300px; top: 59px; position: absolute; height: 154px; width: 755px; text-align: center;" 

            CellSpacing="1" AutoGenerateColumns="False" GridLines="None">


             <Columns>





<asp:BoundField DataField="Rate" HeaderText="Rate" ReadOnly="True" />
                        <asp:BoundField DataField="Qty" HeaderText="Qty" ReadOnly="True" />
                        <asp:TemplateField HeaderText="Total Point">
        <ItemTemplate>
       <asp:GridView1.Rows[i].Cells[10].Text = Convert.ToString(Convert.ToDecimal(GridView1.Rows[i].Cells[7].Text) * Convert.ToDecimal(GridView1.Rows[i].Cells[9].Text)); ReadOnly="True"/>
         </ItemTemplate>
       </asp:TemplateField>
                        <asp:BoundField DataField="Observaciones" HeaderText="Observation" ReadOnly="True" />
                        <asp:BoundField DataField="Date" HeaderText="Additional Date" ReadOnly="True" />



< emptydatatemplate>无可用记录


< rowstyle backcolor =#EFF3FB" horizo​​ntalalign ="Center">
< footerstyle backcolor =#507CD1" font-bold ="True" forecolor ="White">
< pagerstyle backcolor =#2461BF" forecolor ="White" horizo​​ntalalign ="Center">
< HeaderStyle BackColor =#507CD1" Font-Bold ="True" ForeColor ="White" Width ="500px"/>
< alternatingrowstyle backcolor ="White">




我尝试过的事情:

这些是我的代码.我尝试了很多次但都没有成功.请Plz帮助.



<emptydatatemplate>No Record Available


<rowstyle backcolor="#EFF3FB" horizontalalign="Center">
<footerstyle backcolor="#507CD1" font-bold="True" forecolor="White">
<pagerstyle backcolor="#2461BF" forecolor="White" horizontalalign="Center">
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" Width="500px"/>
<alternatingrowstyle backcolor="White">




What I have tried:

These are my code.i try many times but not succeeded.Plz help.

推荐答案


<itemtemplate>
    <%# (Convert.ToDouble(Eval("Rate")) * Convert.ToDouble(Eval("Qty")))  %>
</itemtemplate>


这篇关于如何在GridView中将速率和数量列相乘并在总点列中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 03:51