Hi (Sorry my bad english)
I am trying to create a search to locate a specific element on a single column using the sfDataGrid control since I am migrating a project from the old datagridboundgrid control, which changes a lot in its syntax, how can I perform such a search
Thanks in advanced
Hi ERH,
Your requirement to search value on a specific column in SfDataGrid can be
achieved by using the SearchColumns collection. Please refer to the below code
snippet,
|
private void OnTextChanged(object sender, EventArgs e) { // Search only in Country column this.sfDataGrid.SearchController.SearchColumns.Add("Country");
this.sfDataGrid.SearchController.Search(this.txtSearchBox.Text); } |
UG Link: https://help.syncfusion.com/windowsforms/datagrid/search#search-only-in-selected-columns
Please find the sample in the attachment and let us know if you have any concerns about this.
Regards,
Vijayarasan S
If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.
Thanks a lot
One more question, there is a hand book , where you can see the events of the control, for example I want to identify when the user moves from row, or cell, to identify which one he moved on
Hi ERH,
We suspect that your requirement is to select move from one row to another and identify
the selected row using the event in SfDataGrid. You can achieve this by using the SelectionChanging and SelectionChanged
events. Please refer to the below code snippet,
|
//Event subscription sfDataGrid.SelectionChanging += OnSelectionChanging; sfDataGrid.SelectionChanged += OnSelectionChanged;
//Event customization private void OnSelectionChanged(object sender, SelectionChangedEventArgs e) { //Here customize based on your scenario }
//Event customization private void OnSelectionChanging(object sender, SelectionChangingEventArgs e) { //Here customize based on your scenario } |
UG Link: https://help.syncfusion.com/windowsforms/datagrid/selection#retrieving-the-current-item-and-display-in-message-box
https://help.syncfusion.com/windowsforms/datagrid/selection#cancel-selection
Please find the sample in the attachment and let us know if you have any
concerns about this.
Regards,
Vijayarasan S
If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.