簡體   English   中英

標頭排序后,Datagridview動態按鈕文本消失

[英]Datagridview Dynamic Buttons text disappearing after header sort

通過單擊我的任何標題對datagridview排序時,我的按鈕文本消失了

var MoreInfoCol = new DataGridViewButtonColumn();
MoreInfoCol.Name = "MoreInfoColumn";
MoreInfoCol.HeaderText = "Extended Description";
dataGRID.Columns.Add(MoreInfoCol);

foreach (DataGridViewRow row in dataGRID.Rows)
{
row.Cells["MoreInfoColumn"].Value = row.Cells[2].Value.ToString() + " | More Info";
dataGRID.CellContentClick += new DataGridViewCellEventHandler(dataGRID_CellContentClick);                                        
}

我想到了

MoreInfoCol.UseColumnTextForButtonValue = true; 
MoreInfoCol.Text = "My Value Goes here";

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM