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


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

Add total row in gridview

Posted By: Catherine     Posted Date: June 13, 2011    Points:5   Category :C#
Hi i Am displaying gridview with name,id and salary. i would like to display total for the salary column. how to add the salary column.please tell

Responses
Author: Sasi Prabhu             
Posted Date: June 13, 2011     Points: 20   

R u Bind the values from database into Gridview.

Thanks & Regards,
Sasi Prabhu.
Author: Catherine             
Posted Date: June 13, 2011     Points: 20   

not bind the values from database.

Author: Gowthammanju             
Posted Date: June 13, 2011     Points: 20   

try these link

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

Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true
Author: Gowthammanju             
Posted Date: June 13, 2011     Points: 20   

u can see the following codings as

protected void gvOrganisms_DataBound(object sender, EventArgs e)
{
GridView grid = sender as GridView;

if (grid != null)
{
GridViewRow row = new GridViewRow(0, -1,
DataControlRowType.Header, DataControlRowState.Normal);

TableCell left = new TableHeaderCell();
left.ColumnSpan = 3;
row.Cells.Add(left);

TableCell totals = new TableHeaderCell();
totals.ColumnSpan = grid.Columns.Count - 3;
totals.Text = "Totals";
row.Cells.Add(totals);//add colums to table

Table t = grid.Controls[0] as Table;
if (t != null)
{
t.Rows.AddAt(0, row);
}
}
}


Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true
Author: Gowthammanju             
Posted Date: June 13, 2011     Points: 20   

HEy look at the following url

it may help u

http://aspnetlibrary.com/articledetails.aspx?article=Add-a-total-row-to-a-GridView

Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true
Author: shiv chandra             
Posted Date: June 14, 2011     Points: 20   


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
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

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