BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
GridButtonColumn column = new GridButtonColumn() { MappingName = "PDF_File", HeaderText = "PDF_File" };
this.sfDataGrid1.Columns.Add(column);
this.sfDataGrid1.CellButtonClick += sfDataGrid1_CellButtonClick;
void sfDataGrid1_CellButtonClick(object sender, CellButtonClickEventArgs e)
{
var rowData = (e.Record as Syncfusion.WinForms.DataGrid.DataRow).RowData;
string fileName = (rowData as OrderInfo).PDF_File;
/// Implement the code to open the file in button column
} |
public Form1()
{
InitializeComponent();
this.sfDataGrid1.DataSource = GetDataTable();
this.sfDataGrid1.Columns.Add(new GridNumericColumn() { MappingName = "EmployeeID", HeaderText = "EmployeeID"});
this.sfDataGrid1.Columns.Add(new GridTextColumn() { MappingName = "EmployeeName", HeaderText = "EmployeeName" });
this.sfDataGrid1.Columns.Add(new GridTextColumn() { MappingName = "CustomerID", HeaderText = "CustomerID" });
GridButtonColumn column = new GridButtonColumn() { MappingName = "PDF_File", HeaderText = "PDF_File" };
this.sfDataGrid1.Columns.Add(column);
this.sfDataGrid1.CellButtonClick += sfDataGrid1_CellButtonClick;
this.sfDataGrid1.Columns.Add(new GridDateTimeColumn() { MappingName = "Date", HeaderText = "Order Date", FilterMode = ColumnFilter.DisplayText });
} |
void sfDataGrid1_CellButtonClick(object sender, CellButtonClickEventArgs e)
{
var rowData = (e.Record as Syncfusion.WinForms.DataGrid.DataRow).RowData as DataRowView;
string fileName = rowData["PDF_File"].ToString();
/// Implement the code to open the file in button column
//Process.Start(fileName);
} |
Thanks for the quick reply, that's what I was looking for ... Thank you for your support
here is the code I used
////////////////////////////////////////////////////////////////////////////Start Code ////////////////////////////////////////////////////////////////////////////
this.sfDataGrid1.CellButtonClick += sfDataGrid1_CellButtonClick;
sfDataGrid1.Columns.Add(new GridButtonColumn()
{
MappingName = "PDF_File",
HeaderText = "File"
});
private void sfDataGrid1_CellButtonClick(object sender, Syncfusion.WinForms.DataGrid.Events.CellButtonClickEventArgs e)
{
var rowData = (e.Record as Syncfusion.WinForms.DataGrid.DataRow).RowData as DataRowView;
string fileName = rowData["PDF_File"].ToString();
Process.Start(fileName);
}