.NET5 FlexGrid Filtering , GridNumericColumn

Posted by: info on 11 September 2021, 10:14 pm EST

    • Post Options:
    • Link

    Posted 11 September 2021, 10:14 pm EST - Updated 3 October 2022, 11:39 pm EST

    Hello.

    C1.WPF.Grid.Ja 5.0.20212.110

    I have two questions.

    1. How to set the filtering on c1:GridColumn?

    2.How to set Null on c1:GridNumericColumn?

    Thank you.

    FlexGridStudyNet5.zip

  • Posted 13 September 2021, 4:27 pm EST

    Hi,

    Thank you for providing snapshots and sample.

    1. Filter appears on the basis of Bounded property. You have not bind the column with any property. That’s why Filter isn’t appears. You need to set Binding on Column as: (see code snippet)
    
    <c1:GridColumn
                        MaxWidth="500"
                        AllowSorting="True"
                        Header="Text"
                        Binding="Text"
                        SortMemberPath="Text">
                        .........................
    </c1:GridColumn>
    
    
    1. In order to accept null on GridNumericColumn while editing. You need to handle PrepareCellForEdit event as : (see code snippet)
    
            private void Prepare_Cell(object sender, GridCellEditEventArgs e)
            {
                if (e.Editor is C1NumericBox)
                {
                    C1NumericBox editor = (e.Editor as C1NumericBox);
                    editor.AllowNull = true;
                    var gridValue = (sender as FlexGrid)[e.CellRange.Row, e.CellRange.Column];
                    if (gridValue == null)
                        editor.Value = double.NaN;
                    else
                        editor.Value = (double)gridValue;
                }
            }
    
    

    Please refer the attached sample for the same : FlexGridStudyNet5_Mod.zip

    Best Regards,

    Nitin

  • Posted 13 September 2021, 11:06 pm EST

    Thank you for your help.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels