如何在GridView中将速率和数量列相乘并在总点列中显示 [英] How to multiply rate and qty column and show in total point column in gridview

查看:158
本文介绍了如何在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.

推荐答案

简单!

这是一个示例-计算行总数和使用jQuery的ASP.Net GridView中的总计总计 [
Simple!!!

Here is an example - Calculate Row Total and Grand Total in ASP.Net GridView using jQuery[^].


使用活页夹表达式<%#Eval( "ColumnNam").请通过
执行以下步骤
从< itemptemplate>
删除所有代码
然后把这个

Seems to be fairly simple using binder expressions <%# Eval("ColumnNam"). Plz do following steps by

remove all code from <itemptemplate>

then put this

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


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆