This is a migrated thread and some comments may be shown as answers.

Click event of searchpanel property (GridView)

2 Answers 114 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Burato
Top achievements
Rank 1
Burato asked on 18 Jul 2016, 09:37 AM
Good morning
I am using the SHOWSEARCHPANEL properties datagridview component and I would need to tie me to the click event of the search textbox.
Can you help me?
Thank you

2 Answers, 1 is accepted

Sort by
0
Stefan Nenchev
Telerik team
answered on 20 Jul 2016, 01:32 PM
Hello ,

Generally, if you have the ShowSearchPanel set to true before loading the RadGridView, the TextBox would be the first one that is contained within the RadGridView. With this in mind, in the Loaded event of RadGridView, you can subscribe to the Click event of this TextBox through the following approach:

private void clubsGrid_Loaded(object sender, RoutedEventArgs e)
      {
         var textBox = this.clubsGrid.ChildrenOfType<TextBox>().FirstOrDefault();
         if (textBox != null)
         {
             textBox.PreviewMouseDown += textBox_PreviewMouseDown;
         }
      }
 
      void textBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
      {
          //some logic
      }
You can also find the TextBox through its Name property. The name of the TextBox within the SearchPanel is "PART_SearchAsYouTypeTextBox":

var textBox = this.clubsGrid.ChildrenOfType<TextBox>().Where(x => x.Name == "PART_SearchAsYouTypeTextBox").FirstOrDefault();

In case you are showing the SearchPanel when the RadGridView is already loaded, you can use the SearchPanelVisibilityChanged event of RadGridView.

Please update me whether the information provided was sufficient for your requirement. Of course, if you have any further questions or concerns, do not hesitate to contact us.

Regards,
Stefan Nenchev
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Burato
Top achievements
Rank 1
answered on 20 Jul 2016, 02:21 PM
it works!!!!
Thanks for the help.
Tags
GridView
Asked by
Burato
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Burato
Top achievements
Rank 1
Share this question
or