sfDataGrid.CellButtonClick += SfDataGrid_CellButtonClick;
private void SfDataGrid_CellButtonClick(object sender, Syncfusion.WinForms.DataGrid.Events.CellButtonClickEventArgs e)
{
var fileContent = string.Empty;
var filePath = string.Empty;
using (OpenFileDialog openFileDialog = new OpenFileDialog())
{
openFileDialog.InitialDirectory = "c:\\";
openFileDialog.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
openFileDialog.FilterIndex = 2;
openFileDialog.RestoreDirectory = true;
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
filePath = openFileDialog.FileName;
sfDataGrid.View.GetPropertyAccessProvider().SetValue((e.Record as Syncfusion.WinForms.DataGrid.DataRow).RowData, "FilePath", filePath);
}
}
|
Why the display text of the Button is empty after click on "Click here to add new row" |
The cell values for the AddNewRow will be initialized only when the AddNewRow is initialized. AddNewRow initialization will be triggered only when any of the cell in AddNewRow starts editing. |
Display text appears after edit or double click PathFile Cell? |
Here, the AddNewRow will be initialized and the display text for button is appeared properly. |