如何计算GridView中的总数? [英] How to calculate totals inside gridview?

查看:87
本文介绍了如何计算GridView中的总数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有5列的gridview(Gridview1),如下所示:
1.第一列是数据绑定的.它绑定到SQL Server客户表的"CustomerID"列;
2.第二列是数据绑定的.它绑定到SQL Server客户表的"CustomerName"列;
3.第三列是数据绑定的.它绑定到SQL Server客户表的"ProductID"列;
4.第4列是ItemTamplate.它绑定到SQL Server客户表的"UnitPrice"列.此列包含ItemTamplate内的TexBox(unitPriceTextBox)控件;
5.第五列是ItemTamplate.它绑定到SQL Server客户表的"DiscountPercentage"列.此列包含ItemTamplate内的TexBox(discountPercentageTextBox)控件;
6.第六列是ItemTamplate.它不绑定到任何SQL Server表.但是必须包含该行的总值.此列在ItemTamplate内包含TexBox(totalWithVTATextBox)控件;
现在,我只需要在第1页加载时以及甚至在用户更改了列单元(如更改单位价格或删除特定行)时,以英尺标签(unitPriceTotalLabel)计算总单位价格. 我也想知道如何计算每行的总数,这是:VTA的单位价格.
感谢您的帮助.

I have a gridview(Gridview1) that has 5 columns as below:
1. The 1st column is databound. It binds to a "CustomerID" column of SQL Server customers table;
2. The 2nd column is databound. It binds to a "CustomerName" column of SQL Server customers table;
3. The 3rd column is databound. It binds to a "ProductID" column of SQL Server customers table;
4. The 4th column is an ItemTamplate. It binds to a "UnitPrice" column of SQL Server customers table.This column contains TexBox (unitPriceTextBox) control inside ItemTamplate;
5. The 5th column is an ItemTamplate. It binds to a "DiscountPercentage" column of SQL Server customers table.This column contains TexBox (discountPercentageTextBox) control inside ItemTamplate;
6. The 6th column is an ItemTamplate. It does not bind to any SQL Server table. But has to contain the total value of the row. This column contains TexBox (totalWithVTATextBox) control inside ItemTamplate;
ALL I NEED TO NOW IS HOW TO CALCULATE THE TOTAL UNIT PRICE IN A FOOTER LABEL (unitPriceTotalLabel) WHEN THE PAGE 1st LOADS AND EVEN WHEN THE USER MAKE CHANGES TO A COLUMN CELL LIKE CHANGING UNIT PRICE OR DELETING A SPECIFIC ROW.
I ALSO WANT TO KNOW HOW TO CALCULATE THE TOTAL IN EACH ROW, THIS IS: THE UNIT PRICE WITH VTA.
I appreciate any help.

推荐答案

外观
look https://www.google.nl/search?hl=nl&q=asp.net+gridview+calculate+totals[^].It was 2 seconde Google search.


这篇关于如何计算GridView中的总数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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