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.

Access drop down Values in a Filter bar combox box

Thread ID:

Created:

Updated:

Platform:

Replies:

72167 Mar 5,2008 11:22 PM Mar 25,2008 04:21 PM Windows Forms 2
loading
Tags: GridControl
Jasper Tam
Asked On March 5, 2008 11:22 PM

Hi,

I cannot directly using filter bar for filtering the rows since there are more complex filter requirements. Instead I would like to access the dropdown list values of it.

do you know any ways to do it as it would be quite big effort to access the whole grid and extract the distinct values of a column?


Administrator [Syncfusion]
Replied On March 17, 2008 11:06 AM

Hi Jasper,

We are working on the forum.. We will update you soon.


Administrator [Syncfusion]
Replied On March 25, 2008 04:21 PM

Hi Jasper,

The below method is called to generate dataTable of unique choices for a FilterBar entry. The method inserts (none) and (custom) as the first two entries in the list. The other entries are unique occurrences of entries from the specified column. The (none) and (custom) strings can be changed through "GridFilterBarStrings".

Argument :
>>>>>>>
The "dv" DataView that is being displayed in the grid.
The "colName" column name of the column whose FilterBar choices are being contructed.

protected virtual DataTable CreateUniqueEntries(DataView dv, string colName)
{
DataTable dt = new DataTable(colName);
dt.Columns.Add(new DataColumn(colName));

DataRow dr;
if(GridFilterBarStrings[_none_].Length > 0)
{
dr = dt.NewRow();
dr[0] = GridFilterBarStrings[_none_];
dt.Rows.Add(dr);
}

if(GridFilterBarStrings[_custom_].Length > 0)
{
dr = dt.NewRow();
dr[0] = GridFilterBarStrings[_custom_];
dt.Rows.Add(dr);
}
string s = "";
for(int i = 0; i < dv.Count; ++i)
{
if(s != dv[i].Row[colName].ToString())
{
s = dv[i].Row[colName].ToString();
dr = dt.NewRow();
dr[0] = s;
dt.Rows.Add(dr);
}
}
return dt;
}


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.

;