0
我有一個datagridview
datagridviewbuttoncolumn
,我用按鈕來顯示從另一個表中選擇數據的搜索表單。當從搜索表單用戶選擇的數據我想選擇的數據來更新當前datagridviewrow
: 當datagridview結束時添加行綁定到列出新行添加行後不顯示
當第一次用戶選擇搜索按鈕datagridview
行更新正確和新行添加在行的末尾:
但是當第二次選擇搜索按鈕時,不會出現結尾的新行。
我該如何解決這個問題? 有沒有更好的解決方案來做到這一點?
private void dgvPlannedWoInstruction_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
var senderId = (DataGridView) sender;
if (senderId.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
{
var frmSearch = new FrmStandardInstructionList();
frmSearch.ShowDialog();
if (frmSearch.ucStandardInstructionList1.standardInstructionDto != null)
{
senderId.BeginEdit(true);
PlannedInstructionDTO p;
senderId.NotifyCurrentCellDirty(true);
senderId.BeginEdit(true);
senderId.CurrentRow.Cells["StandardInstructionCode"].Value = frmSearch.ucStandardInstructionList1.standardInstructionDto.Number;
senderId.CurrentRow.Cells["StandardInstructionId"].Value = frmSearch.ucStandardInstructionList1.standardInstructionDto.Id;
senderId.EndEdit();
}
}
}
當您選擇一行時,您希望將其顯示爲GRID結尾的新行? –