Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
105
How to apply formatting on filter data different from column in Ultragris. Need it ASAP
posted

Can we apply different formatting on Filter Data in Ultragrid. For example if column have 1.2000,1.3000, 1.4400 data in a grid and we want filter data should have 1.2, 1.3 ,1.44 data, So basically no zeroes in filter data. Is there any way to apply formatting on Filter data different from column.

Right now we are applying formatting on whole column and filter data is coming in the same format.

For reference below is the code snippet.

UltraGridColumn col = gridDataBoundBlotter.DisplayLayout.Bands[0].Columns[colName_];

col.Format = GUIConstants.DEFAULT_RATE_FORMAT;

col.CellAppearance.TextHAlign = HAlign.Right;


Thanks

  • 1980
    Offline posted

    Hello Garima,


    Since the filter drop down list is populated from the data in the column, they have the same format, but you can create your custom formatting and apply it to the filter drop down items.


    I have attached a sample project to demonstrate the above approach. In the ultraGrid1_AfterRowFilterDropDownPopulate I remove the trailing zeroes from the drop down value list items.


    I do not know what your scenario exactly is, but I guess the data in the column you would like to format are of type string. In that case, the above approach has one drawback. If for example you have a cell with a value “1.220” and another one with “1.2200” in the dropdown you will have “1.22” two times. Even if you remove the duplicates from the dropdown, the filtered rows will contain only one of the rows. So, the better solution is to make the data in the column of type double – that way the trailing zeros will not be displayed anyway.


    Please let me know if you need further assistance regarding this matter.

    UltraGridFormatFilterRow.zip