Click event of searchpanel property (GridView)

3 posts, 0 answers
  1. Burato
    Burato avatar
    2 posts
    Member since:
    Oct 2012

    Posted 18 Jul Link to this post

    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. Stefan Nenchev
    Stefan Nenchev avatar
    238 posts

    Posted 20 Jul Link to this post

    Hello Burato,

    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.

    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.
  3. DevCraft R3 2016 release webinar banner
  4. Burato
    Burato avatar
    2 posts
    Member since:
    Oct 2012

    Posted 20 Jul in reply to Stefan Nenchev Link to this post

    it works!!!!
    Thanks for the help.
Back to Top