![](/img/trans.png)
[英]focus in a cell value of DataGridView C# windows forms on adding a row
[英]adding footer value to datagridview in C#
我有 2 個數據表。 一個是用戶選擇該表的實際值,下一個是該表的匯總值,即任何總計或平均值。 我想將其顯示為 C# datagridview 中的頁腳。 我怎樣才能做到這一點??? 在 asp.net 中,我們有 RowDataBound 事件,就像 C# 中也有類似的東西,但我找不到它是什么。
您可以使用GridView
ondatabound
事件來填充頁腳。 樣本:
protected void GridView1_DataBound(object sender, EventArgs e)
{
GridView grid = sender as GridView;
grid.FooterRow.Cells[0].Text = CustomDataSource.GetAggregated.Rows[0]["Name"].ToString();
grid.FooterRow.Cells[1].Text = CustomDataSource.GetAggregated.Rows[0]["Total"].ToString();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.