且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将任何gridview列添加到网格视图中。在c#windows应用程序中

更新时间:2023-10-07 09:29:58

  int  sum =  0 ; 
foreach (GridViewRow row in nameofthegrid.Rows)
{
标签总和=(标签)row.FindControl( 要添加的项目模板中的列标签ID) ;
sum = sum + int.Parse(sum.Text);
TextBox1.Text = sum;
}



-values-in-grid / [ ^ ]

显示Gridview页脚中的总和(列值)[ ^ ]


I have column name total_prize i have 10 records . I want to calculate prize of all products present in grid_view also it should print because I also want to get print into pdf for this the record should present into grid_view
For Purpose of printing I can't use external textbox/label to get addition into it.

int sum=0;
foreach (GridViewRow row in nameofthegrid.Rows)
{
 Label sum = (Label)row.FindControl(" column label id in item template to be add");
sum=sum+int.Parse(sum.Text);
TextBox1.Text=sum;
}


http://www.c-sharpcorner.com/UploadFile/rohatash/adding-values-in-column-and-sum-of-the-column-values-in-grid/[^]
To show the Sum of Total(Column Value) in Gridview Footer[^]