This is a migrated thread and some comments may be shown as answers.

numericcolumn and between filter

4 Answers 267 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fraz
Top achievements
Rank 1
Fraz asked on 11 May 2010, 06:06 PM
I have a grid that has a GridNumericColumn and AllowFilteringByColumn="True".  the filter has a value for between and notbetween.  since the numericcolumn does not allow spaces or alpha how do you use the between filter?

4 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 14 May 2010, 08:22 AM
Hello Fraz,

I can not confirm that the 2010.1.415 version of the GridNumericColumn supports "Between", "NotBetween" options in its filtering menu.

In order to apply the above mentioned filtering operations to a numeric data, you should bind the data to a GridBoundColumn and sets its DataType property to the appropriate type. This way the filtering operation will be performed correctly. Here is a sample code:

<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="true" OnNeedDataSource="RadGrid1_NeedDataSource"
    AutoGenerateColumns="false">
    <MasterTableView>
        <Columns>
            <telerik:GridNumericColumn DataField="NumericColumn" UniqueName="NumericColumn" HeaderText="NumericColumn">
            </telerik:GridNumericColumn>
            <telerik:GridBoundColumn DataField="BoundColumn" UniqueName="BoundColumn" HeaderText="BoundColumn"
                DataType="System.Int32">
            </telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

Code behind:

protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
    DataTable table = new DataTable();
    table.Columns.Add("NumericColumn", typeof(Int32));
    table.Columns.Add("BoundColumn");
    for (int i = 0; i < 25; i++)
    {
        table.Rows.Add(i,i.ToString());
    }
    RadGrid1.DataSource = table;
}

Running the code above, you should be able to filter the bound column values using the "Between", "NotBetween" options.  Note that you should use a "space" character as a value separator.

I hope this helps,
Martin
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Lorenzo
Top achievements
Rank 1
answered on 23 May 2014, 07:50 AM
Hi, 
I resume this old topic, because I'm encountering the same problem. 
Using the GridNumericColumn I lose the "between" filter functionality, and using the GridBoundColumn I lose the automatic formatting of the filter text box (I use an it-IT culture, with "," as decimal separator), the possibility of using the comma as decimal separator for filters, etc. How can I solve the problem?
Thanks, 
Lorenzo

0
Douglas
Top achievements
Rank 1
answered on 27 May 2014, 09:11 AM
I get the same behavior as Lorenzo when using the GridNumericColumn from the latest release. There is not Between or Not Between filter.
0
Milena
Telerik team
answered on 27 May 2014, 04:01 PM
Hello,

Between and NotBetween filter options are available only for GridBoundColumn and GridDateTimeCoulmn. For GridDateTimeColumnd, it is necessary to set EnableRangeFiltering property to "true" for the specific column. So, I would recommend you to follow the approach suggested by Martin Atanasov in order to use range filtering for numeric data.

In regard of formatting, it it necessary manually to set the needed format when using this approach.
Here is an example:
<telerik:GridBoundColumn ... DataFormatString="{0:0.000}" ... >
                       </telerik:GridBoundColumn>

I hope this helps.

Regards,
Milena
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Fraz
Top achievements
Rank 1
Answers by
Martin
Telerik team
Lorenzo
Top achievements
Rank 1
Douglas
Top achievements
Rank 1
Milena
Telerik team
Share this question
or