Current filter:
                                You should refresh the page.
                                  • Good morning Devexpress staff

                                    I had bene trying to set a filter for first gridview load without success

                                    I am trying to set a date filte after the first load, using the next code

                                    grdPuestos.DataSource = dtPuestos grdPuestos.KeyFieldName = "EMST_ID" If primera_carga = 1 Then grdPuestos.FilterExpression = "[FECHA_INICIO] = '" & dia & "/" & mes & "/" & ano & "'" grdPuestos.PageIndex = 0 grdPuestos.DataBind() grdPuestos.BeginUpdate() grdPuestos.EndUpdate()

                                    Why is not working properly?

                                    there is a field name FECHA_INICIO I can asure that

                                       <dx:BootstrapGridViewDateColumn  FieldName="FECHA_INICIO" Caption="F. inicio" HorizontalAlign="center" />

                                1 Solution

                                Creation Date Importance Sort by

                                Hello Sergio,

                                I researched this issue and found its cause.
                                The filter expression should be specified in a special format described in the Criteria Language Syntax article.
                                In addition, since you want to use strict equality, you should take into account the fact that the data can contain not only the date, but also the time.
                                In this case, I recommend that you use our Criteria Operators.

                                Dim day As Integer = 6 Dim mounth As Integer = 10 Dim year As Integer = 2019 Dim date = New DateTime(year, mounth, day) Dim startOperator = New BinaryOperator("_Date", date, BinaryOperatorType.GreaterOrEqual) Dim endOperator = New BinaryOperator("_Date", date.AddDays(1), BinaryOperatorType.Less) grdPuestos.FilterExpression = New GroupOperator(GroupOperatorType.And, startOperator, endOperator).ToString() grdPuestos.DataBind()

                                Please try this approach and let me know your results.

                                Show all comments
                                • Sergio Aguaviva 10.01.2019

                                  It is not working

                                  when I apply the filter it shows nothing on the grid

                                  instead of declaring a variable I am using as you can see in the above code

                                  If primera_carga = 1 Then Dim startOperator = New BinaryOperator("_Date", Now.Date, BinaryOperatorType.GreaterOrEqual) Dim endOperator = New BinaryOperator("_Date", Now.Date.AddDays(1), BinaryOperatorType.Less) grdPuestos.FilterExpression = New GroupOperator(GroupOperatorType.And, startOperator, endOperator).ToString() End If
                                • Artemy (DevExpress Support) 10.01.2019

                                  Hello Sergio,
                                  As I can see, you are trying to use the code that I suggested above. But you did not modify it for your project. In order to provide you with a solution, I created my own project, in which I used my own fields.
                                  Note that you should specify the name of date field as the first argument of the BinaryOpperator constructor.
                                  It looks like, in your case, you need to use a field named FECHA_INICIO instead of the _Date field that I created.
                                  Please let me know if this helps.

                                • Sergio Aguaviva 10.02.2019

                                  Yes I already changed it for FECHA_INICIO but still not working

                                  I am thinking about a different approach

                                  how I can see if the colum (FECHA_INICIO) has a filter applied?

                                  I want to construct the SQL QUERY WHERE depending on if they have applied a filter on FECHA_INICIO row

                                • Artemy (DevExpress Support) 10.02.2019

                                  Hello Sergio,
                                  As I can see, your FilterExpression now looks like: "return all rows in which the value in the FECHA_INICIO column is greater than midnight today, but less than midnight tomorrow"
                                  Please make sure you have rows with this value.
                                  Please also clarify what type the FECHA_INICIO column in the database has.

                                • Sergio Aguaviva 10.03.2019

                                  the type is date

                                  and yes I have results between those 2 dates but the code is not working

                                  I partially solved it applying the filter directly on the SQL query

                                • Artemy (DevExpress Support) 10.04.2019

                                  Hello Sergio,

                                  I tried to reproduce this issue using the SqlDataSource and SQL database with the column type of date, but without success. Please see my results in the video I attached.
                                  Could you please modify the attached project to reproduce the issue, so that I can research it on my side and provide you with the most appropriate solution.

                                • Sergio Aguaviva 10.09.2019

                                  thanks Artemy, now is wokring correctly

                                • Artemy (DevExpress Support) 10.09.2019

                                  You are welcome!