sfDataGrid.Columns[1].HeaderStyle.FilterIcon = new Bitmap(Image.FromFile(@"..\..\FilterIcon.png"));
sfDataGrid.Columns[0].HeaderStyle.FilteredIcon = new Bitmap(Image.FromFile(@"..\..\FilteredIcon.png"));
but it give me error like out of range. could you please provide a working example?
Hi Thank you for the response.
following the same example and below are my requirements.
Queries |
Solutions | |
the data is save in a txt format. |
Your requirement can be achieved export the SfDataGrid into Excel. The exported workbook can be saved as txt file by using the SaveAs method. Please refer the below code snippet,
For more information related to SaveAs exported excel file, please refer the user guide documentation,
UG Link: https://help.syncfusion.com/windowsforms/datagrid/exporttoexcel#export-to-csv | |
In forms, I have a button to insert the txt file.
|
You can get the txt file via OpenFileDialog and pass the path value to LoadUserListFromFile extension method in application. Please refer the below code snippet,
Stack Overflow Link: https://stackoverflow.com/questions/55453502/how-to-read-a-text-file-and-add-the-data-to-a-data-grid-view-that-has-a-binding
| |
I will load the txt file data into sfdatagrid. |
Your requirement can be achieved by underline model or object (OrderInfo) defined you can add a static method to it that loads the data to a list of OrderInfo and bind it to the SfDataGrid. Please refer the below code snippet,
Stack Overflow Link: https://stackoverflow.com/questions/16498614/reading-from-txt-file-then-exporting-data-to-datagridview
| |
when the button is click, it will load the txt file, put it into sfdatagrid with custom headerstyle filter icon.
|
In SfDataGrid loaded with txt file we need apply apply custom filtered icon for Column in SfDataGrid. Please refer the below code snippet,
|
thank you, all works.