Access drop down Values in a Filter bar combox box

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?


2 Replies

AD Administrator Syncfusion Team March 17, 2008 03:06 PM UTC

Hi Jasper,

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



AD Administrator Syncfusion Team March 25, 2008 08:21 PM UTC

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



Loader.
Up arrow icon