I have a text box above the ultra grid. Initially grid will be filled up with some data(Names of the account holders). When I type the words in the text box, I should show the contains words only in the grid. Rest of the data should be hidden or deleted(Whichever is most efficient way).
Ex.
Lets say, Grid is filled with the following names
Inragistics
Uthay
Verdana
Steve
When i type the word 't', grid should now show only
as Verdana doesnt contains the word 't'. This should be eliminated
When i type the word 'te', grid should now show only
as Steve only contains the word 'te'. Others should be eliminated.
How can i achive this. Note: I cannot compromise the design. Need to achieve it thru seperate textbox only.
@Hady,
Search is inconsistent in the solution that you have given. Say, If i type the word 'Bank' , it shows
Bank Deposit,
Private Banker,
Bank Program,
Bank Location
Then when i append 'e', that is 'Banke', then grid shows nothing
'<No records>'
It should have shown, Private Banker. But it failed show.
But when it append the word 'r', that is 'Banker', then grid shows the record 'Private Banker'. Why this inconsistency is happening?
Hello Mike, I am going to apply the Hady solution. I know that the solution given by you is available. But the design should not be compromised. Requirements were finalized. So please let me know if we can use any other better solution for this.
Hi,
Are you aware that the grid has built-in functionality for a filter row which will do this in the grid by just setting a few properties?
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; UltraGridOverride ov = layout.Override; ov.FilterUIType = FilterUIType.FilterRow; ov.AllowRowFiltering = DefaultableBoolean.True; ov.FilterOperatorDefaultValue = FilterOperatorDefaultValue.Contains; }
add this event to the text box (utxtFilter is the name of the textbox)
private void utxtFilter_TextChanged(object sender, EventArgs e)
{
try
if (utxtFilter.Text.Trim() != string.Empty)
ColumnFiltersCollection columnFilters = this.UltraGrid1.DisplayLayout.Bands[0].ColumnFilters;
columnFilters.ClearAllFilters();
foreach (UltraGridColumn uCol in UltraGrid1.DisplayLayout.Bands[0].Columns)
if (uCol.Hidden == false)
columnFilters[uCol.Index].FilterConditions.Add(FilterComparisionOperator.Contains, utxtFilter.Text.Trim());
}
UltraGrid1.DisplayLayout.Bands[0].ColumnFilters.LogicalOperator = FilterLogicalOperator.Or;
UltraGrid1.Rows.ExpandAll(true);
else if (utxtFilter.Text.Trim() == string.Empty)
UltraGrid1.DisplayLayout.Bands[0].ColumnFilters.ClearAllFilters();
UltraGrid1.ActiveRowScrollRegion.Scroll(RowScrollAction.Top);
catch