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. Image for the cookie policy date
close icon

Data ID''s in FilterBoxes instead of values

Hi!
I'm using Essential Studio 3.2.1.0
I met such a problem with filtering in GridGroupingControl.
If i try to filter column with non-numerical values?
in filterboxes there are id's of filtering values instead of values, though in the grid it is ok.

And corresponding problem. If I try to create Custom filter in runtime, I see GUID's of columns in Members window instead of columns' names

4 Replies

AD Administrator Syncfusion Team November 14, 2006 06:54 AM UTC

Hi Flashnik,

I have created the sample as per your requirement. The attached sample implements owner drawing in a listBox control of a dropdown filterbar. It displays the 'Value' column items in the dropdown list of the 'ID' column. Please try the sample and let me know if this helps.

Here is a sample
http://www.syncfusion.com/Support/user/uploads/ChangeFilterDropDown_cb6feca9.zip

Best Regards,
Haneef


AD Administrator Syncfusion Team November 14, 2006 10:41 AM UTC

Thank you, your sample is very useful.
Still, I encounter problems if I use my dictionary to substitute numerical values by their dictionary meanings. In the grid these values are substituted, but in filterboxes I see numerical values. How can I substitute values in filterboxes?


AD Administrator Syncfusion Team November 14, 2006 11:24 AM UTC

Hi Flashnik,

You can handle the ListBoxPart.DrawItem event and draw the substituted values to the dropdown listbox control. Before handling the DrawItem event, you should set the ListBoxPart.DrawMode property to DrawMode.OwnerDrawFixed in CurrentCellShowingDropDown event. Here is a sample code snippet.

int savedIndex = -1;
string SelectedText = string.Empty;
private void ListBoxPart_DrawItem(object sender, DrawItemEventArgs e)
{
//Declare the SavedIndex as the Class Member.....
//int savedIndex = -1;
ListBox list = sender as ListBox;
StringFormat format = new StringFormat();
format.LineAlignment = StringAlignment.Center;
format.Alignment = StringAlignment.Center;

RectangleF rect = new RectangleF(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);

///// dText is the drawing text of the DropDown listBox
//// dText is the DisplayText of the DropDown listBox
//// you can assign any of the text to dText here
////--------------------------------------------------------------------------------------------------------////
string dText = list.Items[e.Index].ToString();
if( e.Index >2)
dText = parentTable.Rows[e.Index - 3]["Value"].ToString();
////--------------------------------------------------------------------------------------------------------////

if (list.SelectedIndex == e.Index )
{
if(savedIndex != -1 && savedIndex != list.SelectedIndex )
list.Invalidate(list.GetItemRectangle(savedIndex));
savedIndex = list.SelectedIndex;
e.Graphics.FillRectangle(Brushes.Gold, e.Bounds);
e.Graphics.DrawString(dText, list.Font, new SolidBrush(list.BackColor), rect, format);
SelectedText = dText;
}
else
{
e.Graphics.FillRectangle(Brushes.LightGoldenrodYellow, e.Bounds);
e.Graphics.DrawString(dText, list.Font, new SolidBrush(list.ForeColor), rect, format);
}
}

Sample : http://www.syncfusion.com/Support/user/uploads/ChangeFilterDropDown_cb6feca9.zip

Best Regards,
Haneef


AD Administrator Syncfusion Team November 14, 2006 12:07 PM UTC

And is it possible to get the same results using GridRelationDescriptor?

Loader.
Live Chat Icon For mobile
Up arrow icon