.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

How can I add label to calculate from a gridview

Posted By: MoeLu     Posted Date: July 24, 2012    Points:5   Category :ASP.Net
I have a grid view with three columns

Weight | Completion | Score
2 | 0.50 | 1
5 | 0.50 | 2.5
4 | 0.50 | 2

The score column is a result of weight*completion which is working fine

Now, what I am asking is that i want to add labels outside the gridview to do some caculations, i don't want it to be included inside the gridview but separated.
and the labels to be like:

Label1 = (Total or sum) of weight column
Label2 = (Total or sum) of Score column
Label3 = (Label2 / Label1)*100

How can I perform such calculations for this?
I'm new at this and i am using c# .net web application
NOTICE: I don't have a behind code only aspx code page

Author: Syed Shakeer Hussain             
Posted Date: July 25, 2012     Points: 20   

you can try this. but it needs DataSet.

DataSet ds=new DataSet();
DataTable table=new DataTable();

Label1.Text =Convert.ToString( table.Compute("Sum(Weight)", String.Empty));

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend