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

GridFilterBar

Hi,

I have an urgent request about a specialization of the GridFilterBar.
I was given some code by Syncfusion to handle private keys in the FilterBar. The specialization overrides GetFilterFromRow to swap the display string with the actual value (an ID) needed by the FilterBar.
For the current column, the values are retrieved using:
s = "'" + cc.Renderer.ControlText + "'";
s1 = "'" + cc.Renderer.ControlValue.ToString() + "'";

For the other option previously selected, the code is:
s = "'" + grid[row, col].GetFormattedText(grid[row, col].CellValue);
s1 = "'" + grid[row, col].CellValue.ToString() + "'";
But this code is not working.
I can retrieve the value displayed with:
s = "'" + grid[row, col].CellValue.ToString() + "'";
But I don't know how to retrieve the value needed by the filter. Something like:
s1 = "'" + grid[row, col].Cell.Renderer.ControlValue.ToString() + "'";
similar to the way it works for the current column.

This is an urgent request. A quick answer will be highly appreciated.




3 Replies

HA haneefm Syncfusion Team February 7, 2008 11:13 PM UTC

Hi Stephane,

Please refer to the following sample that works fine with this code in filtering by the displaymember. This should work if you choose a value from combobox. In this sample we replace the selected value (DisplayMember) with Valuemember and apply the filter to the underlying Datatable. Check the GetFilterFromRow() code in the sample for more details.

http://www.syncfusion.com/Support/user/uploads/ForumFilterBarDisplayMember_deee6d37.zip

Let me know if this helps.

Regards,
Haneef




SD Stephane Dapsanse February 7, 2008 11:30 PM UTC

Hi Rajagopal,

Your example has the same issue I have (I am using the exact same code).

if(cc.ColIndex == col)
{
s = "'" + cc.Renderer.ControlText + "'";
s1 = "'" + cc.Renderer.ControlValue.ToString() + "'";
}
else
{
s = "'" + grid[row, col].GetFormattedText(grid[row, col].CellValue);
s1 = "'" + grid[row, col].CellValue.ToString() + "'";

}
filter = filter.Replace(s, s1);


Your example never reaches the else-block because there is only one column with a foreign key in your example.
But the statements in your else-block are actually not working.
s is the displayed value: this can be retrieved with s = "'" + grid[row, col].CellValue.ToString() + "'";
s1 is the id that should replace the displayed value: this is the value I don't know how to retrieve

By the way, the if-block works just fine, but only for the current cell. I want the exact same behaviour but for a cell of column col and a row = filter's row.

Thanks,
Stephane



HA haneefm Syncfusion Team April 9, 2008 05:46 PM UTC

Hi Stephane,

Thank you for your update.

I am not sure of what be might be causing this strange behavior without a working sample. I have tested this issue in the attached sample with Essentail studio V.4.x/5.x. But i was not able to reproduce the issue. Is it possible for you to upload us a minimal sample or modify the browser sample to reproduce the issue here? This will help us to analyse the issue further.

Sample : ModifiedFilterBarDisplayMember.zip

Thanks for using Syncfusion product.

Best regards,
Haneef


Loader.
Live Chat Icon For mobile
Up arrow icon