C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




gridview


Posted Date: 05 Sep 2008      Total Responses: 2

Posted By: vishnupriya       Member Level: Silver     Points: 1



i want the total of a column data values of gridview ...so at last row of my grid i need the total of each column data values...

its very urgent
help






Responses

Author: Appukuttan    05 Sep 2008Member Level: DiamondRating:     Points: 2

Refer:

http://msdn.microsoft.com/en-us/library/ms972833.aspx

http://it.maconstate.edu/tutorials/ASPNET20/ASPNET07/aspnet07-05.aspx

http://programming.top54u.com/post/ASPNet-20-GridView-Compute-Column-Sum-using-C-sharp.aspx

http://www.vinull.com/Post/2006/02/15/aspnet-adding-a-total-to-gridview.aspx



Author: suze    05 Sep 2008Member Level: GoldRating:     Points: 6

Hi

check this eg it may help u
int dtrow = 0;
foreach (GridViewRow row in GridView1.Rows)
{
double f = 0.000, s = 0.00, t = 0.00, fo = 0.00, fi = 0.00, si = 0.00, se = 0.00,tot=0.00;
int a=0, b, c, d, g, h, i;

a =a+ Convert.ToInt32(dt.Rows[dtrow][6].ToString());

s = s + Convert.ToDouble(dt.Rows[dtrow][7].ToString());

t =t + Convert.ToDouble(dt.Rows[dtrow][8].ToString());

fo =fo + Convert.ToDouble(dt.Rows[dtrow][9].ToString());

fi =fi + Convert.ToDouble(dt.Rows[dtrow][10].ToString());

si =si + Convert.ToDouble(dt.Rows[dtrow][11].ToString());

se =se + Convert.ToDouble(dt.Rows[dtrow][12].ToString());

tot =tot + Convert.ToDouble(dt.Rows[dtrow][13].ToString());


f = a;

lbld1.Text = f.ToString();
//lbld1.Text = f.ToString();
lbld2.Text = s.ToString();
lbld3.Text = t.ToString();
lbld4.Text = fo.ToString();
lbld5.Text = fi.ToString();
lbld6.Text = si.ToString();
lbld7.Text = se.ToString();
lbltot.Text = tot.ToString();
dtrow++;
}



Post Reply
You must Sign In to post a response.
Next : can anyone solve this issue?
Previous : how to capture UserRole thru session
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use