Approved
Last Updated: 10 May 2016 09:34 by ADMIN
ADMIN
Dimitar
Created on: 12 Apr 2016 10:15
Category: GridView
Type: Bug Report
0
FIX. RadGridView - incorrect result when using the search functionality with the SendKeys method.
To reproduce:
Search a specific text by focusing the search box programmatically and the using the SendKeys method:
private void radButton1_Click(object sender, EventArgs e)
{
    GridSearchCellElement searchCell = radGridView1.TableElement.GetCellElement(radGridView1.MasterView.TableSearchRow, null) as GridSearchCellElement;
    if (searchCell != null)
    {
        searchCell.SearchTextBox.Focus();
        searchCell.SearchTextBox.Text = string.Empty;
        SendKeys.Send("t");
        SendKeys.Send("e");
        SendKeys.Send("s");
        SendKeys.Send("t");
    }
}

Workaround: 
Repeat the search in the SearchProgressChanged event:

radGridView1.MasterView.TableSearchRow.SearchProgressChanged += TextationSearchProgressHandler;

protected void TextationSearchProgressHandler(object sender, SearchProgressChangedEventArgs e)
{
    if (e.SearchFinished && null != radGridView1.TableElement)
    {
        GridSearchCellElement searchCell = radGridView1.TableElement.GetCellElement(radGridView1.MasterView.TableSearchRow, null) as GridSearchCellElement;
        if (searchCell != null
             && searchCell.SearchTextBox.TextBoxItem.Text != e.SearchCriteria)
        {
            radGridView1.MasterView.TableSearchRow.Search(searchCell.SearchTextBox.TextBoxItem.Text);
        }
    }
}
0 comments