我想在网格视图中计算数据 [英] I want to calculate data in grid view
问题描述
对于ex,我有一个网格视图,数据以这种方式计算,
ID加入日期周期时间计划ID金额百分比利息月TotalInt。
1111 01/02/2013 0-10 2 10,000 8% 800 30 24000
2222 06/12/2012 11-20 1 5,000 4%200 30 6000
3333 09/15/2013 21-30 1 1,00,000 4% 4000 30 120000
4444 18/03/2013 11-20 2 1,00,000 8%8000 30 240000
喜欢这个,现在怎么样我可以在网格视图中做这种类型的计算吗?请帮我..
< asp:templatefield headertext = 兴趣 xmlns: asp = #unknown >
< itemtemplate > ;
< asp:textbox >
ID =txtInterest
ReadOnly =true
runat =server
Text ='<%#Convert.ToDeci mal(Eval( Amount)。ToString())*(Convert.ToDecimal(Eval(< span class =code-string> 百分比)。ToString())/ 100).ToString( c)%>'
宽度=55px>
< / asp:textbox >
< / itemtemplate >
< / asp :templatefield >
< asp:templatefield headertext = TotalInt xmlns: asp = #unknown >
< itemtemplate >
< asp :textbox >
ID =txtMonths
ReadOnly =true
runat =server
Text ='<%#(Convert.ToDecimal(Eval( Amount)。ToString())*(Convert.ToDecimal(Eval( 百分比)。ToString())/ 100))*(Convert.ToDecimal(Eval( 月)。ToString())。ToString( c)%> '
宽度=55px>
< / asp:textbox >
< / itemtemplate >
< / asp :templatefield >
推荐
http://www.dreamincode.net/论坛/主题/ 253787-performing-calculation-in-gridview-itemtemplate / [ ^ ]
另一种方法
GridView中的数据库驱动的客户端计算 [ ^ ]
在数据绑定到网格视图之前,您必须进行这些计算。您必须更改使用for循环的每行的被恢复单元格的值。然后用网格视图绑定。
hey I want to calculate data in grid view, how to do it??
for ex, I have one grid view, data calculate in this way,
ID Join Date Cycle Period Plan ID Amount Percentage Interest Month TotalInt.
1111 01/02/2013 0-10 2 10,000 8% 800 30 24000
2222 06/12/2012 11-20 1 5,000 4% 200 30 6000
3333 09/15/2013 21-30 1 1,00,000 4% 4000 30 120000
4444 18/03/2013 11-20 2 1,00,000 8% 8000 30 240000
Like this, now how can i do in grid view this type of calculation?? plz help me..
<asp:templatefield headertext="Interest" xmlns:asp="#unknown"> <itemtemplate> <asp:textbox> ID="txtInterest" ReadOnly="true" runat="server" Text='<%# Convert.ToDecimal(Eval("Amount").ToString()) * (Convert.ToDecimal(Eval("Percentage").ToString())/100).ToString("c") %>' Width="55px"> </asp:textbox> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="TotalInt" xmlns:asp="#unknown"> <itemtemplate> <asp:textbox> ID="txtMonths" ReadOnly="true" runat="server" Text='<%#(Convert.ToDecimal(Eval("Amount").ToString()) * (Convert.ToDecimal(Eval("Percentage").ToString())/100))*(Convert.ToDecimal(Eval("months").ToString()).ToString("c") %>' Width="55px"> </asp:textbox> </itemtemplate> </asp:templatefield>
Refer
http://www.dreamincode.net/forums/topic/253787-performing-calculation-in-gridview-itemtemplate/[^]
Another approach
Database driven client side calculations in GridView[^]
You have to do these calculation before data bind to grid view .you have to change the value of recuired cells of each row using a for loop. and then bind with grid view.
这篇关于我想在网格视图中计算数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!