We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

fill and use custom filter values in GridGroupingControl

Thread ID:

Created:

Updated:

Platform:

Replies:

50101 Oct 5,2006 10:29 AM Oct 6,2006 06:22 AM Windows Forms 3
loading
Tags: GridControl
Vitaliy
Asked On October 5, 2006 10:29 AM

Hello!
Help me please how I could fill and use custom filter values in GridGroupingControl?

Administrator [Syncfusion]
Replied On October 6, 2006 03:29 AM

Hi Vitaliy,

Issue 1:

Do you want to use filter record? If so, you can use FilterRecords collection to find the filter records in a grid. Here is a code snippet

GridTable table = this.grid.Table;
foreach( Record frec in table.FilteredRecords)
{
Console.WriteLine("Record Info : " + frec);
}

Issue 2:

Do you want to use filtered string? If so, you can use GetFilterBarText method to get the filterbar text in a column of the grid. Below is a code.

GridTableFilterBarCellRenderer cr = this.grid.TableControl.CellRenderers["FilterBarCell"] as GridTableFilterBarCellRenderer;
if( cr != null)
{
Console.WriteLine( cr.GetFilterBarText(this.grid.TableModel[3,2] ));
}

Best Regards,
Haneef

Vitaliy
Replied On October 6, 2006 05:29 AM

Hi Haneef,
not, I want fill drop-down filter to my custom values. And when user clicked on filter list, I want set custom filter. This code raize error, index list out of bounds :

int RowIndex = -1;
int colIndex = -1;
bool IsDropDown = false;
string ColumnName = string.Empty;

private void clientGridControl_TableControlCurrentCellShowingDropDown(object sender, GridTableControlCurrentCellShowingDropDownEventArgs e)
{
GridTableCellStyleInfo table = e.TableControl.CurrentCell.Renderer.CurrentStyle as GridTableCellStyleInfo;
RowIndex = e.TableControl.CurrentCell.RowIndex;
colIndex = e.TableControl.CurrentCell.ColIndex;
IsDropDown = true;
GridComboBoxCellRenderer cr = e.TableControl.CurrentCell.Renderer as GridComboBoxCellRenderer;
if (table.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.FilterBar)
{
ColumnName = table.TableCellIdentity.Column.MappingName;
if (ColumnName == "StateString" && cr != null)
{
//cr.ListBoxPart.Items.Clear();
foreach (DataRow row in _dataService.MasrerItemsObjects.Tables[DataService.STATE].Rows)
{
cr.ListBoxPart.Items.Add(row[DataService.STATE_NAME]);
}
cr.ListBoxPart.Click += new EventHandler(ListBoxPart_Click);
}
}
}

private void ListBoxPart_Click(object sender, EventArgs e)
{
ListBox list = sender as ListBox;
if (list.SelectedIndex != -1)
{
if (ColumnName == "StateString")
{
if (IsDropDown)
{
IsDropDown = false;
this.clientGridControl.Engine.TableDescriptor.RecordFilters.Remove(ColumnName);
if (list.SelectedIndex > 2)
{
this.clientGridControl.Engine.TableDescriptor.RecordFilters.Add(ColumnName, FilterCompareOperator.Like, "*" + list.SelectedItem + "*");
}
}
list.SelectedIndex = 0;
}
}
}

Administrator [Syncfusion]
Replied On October 6, 2006 06:22 AM

Hi Vitaliy,

Please refer to this KB article for customize the filterbar entry in a grid.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=323

Best Regards,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;