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

How do I set the visibility of the Search row ?

1 Answer 289 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Czeshirecat
Top achievements
Rank 2
Iron
Iron
Czeshirecat asked on 14 Jul 2017, 12:19 PM

Hi,

How do I set the visibility of the search row programatically please.? I know I can show it using ctrl F (Localization, does this change for chinese equivalent?) but we don't want to have users phoning us up for support if they click the close button and they don't know about the ctrl F option.

At the moment I'm calling the following to force it to appear from a context menu option.

dataGrid.AllowSearchRow = false;
dataGrid.AllowSearchRow = true;

From finding a thread on the forum I can read the visibility by calling

var searchCell = dataGrid.TableElement.GetCellElement(dataGrid.MasterView.TableSearchRow, null) as GridSearchCellElement;
if (searchCell != null) return searchCell.Visibility != ElementVisibility.Hidden;

But if I set searchCell.Visibility then I'm still seeing the row that would hold the search controls, but the controls themselves are hidden.

thanks :)

 

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 17 Jul 2017, 11:13 AM
Hello Claire,

You can get the row and show/hide it with the following code:
var row = radGridView1.MasterView.TableSearchRow as GridViewSearchRowInfo;
row.IsVisible = !row.IsVisible;

Make sure that AllowSearchRow is set to true as well.

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
Czeshirecat
Top achievements
Rank 2
Iron
Iron
Answers by
Dimitar
Telerik team
Share this question
or