I am adding a default initial filter from the code-behind, but I'm getting an error:
System.Web.Query.Dynamic.ParseException
- MyGrid :
<
telerik:RadGrid
ID
=
"RG_Lst_CS"
runat
=
"server"
DataSourceID
=
"LDS_SuiviCommande"
OnPreRender
=
"RG_Lst_CS_PreRender"
EnableLinqExpressions
=
"true"
EnableHeaderContextFilterMenu
=
"True"
EnableHeaderContextMenu
=
"True"
AllowFilteringByColumn
=
"True"
AllowPaging
=
"True"
AllowSorting
=
"True"
>
<
MasterTableView
AutoGenerateColumns
=
"False"
>
<
Columns
>
<
telerik:GridDateTimeColumn
DataField
=
"CCE_DateReception"
HeaderText
=
"Date Reception"
SortExpression
=
"CCE_DateReception"
UniqueName
=
"CCE_DateReception"
EnableTimeIndependentFiltering
=
"true"
DataType
=
"System.DateTime"
DataFormatString
=
"{0:d}"
/>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
- Code behind :
protected
void
RG_Lst_CS_PreRender(
object
sender, EventArgs e)
{
if
(!Page.IsPostBack)
{
var DefaultDateInterval = DateTime.Today.AddDays(
(DayOfWeek.Monday - DateTime.Today.DayOfWeek) - 14);
RG_Lst_CS.MasterTableView.FilterExpression =
"([CCE_DateReception] >= DateTime.Parse(\""
+ DefaultDateInterval +
"\")) "
;
GridColumn column = RG_Lst_CS.MasterTableView.GetColumnSafe(
"CCE_DateReception"
);
column.CurrentFilterFunction = GridKnownFunction.GreaterThanOrEqualTo;
column.CurrentFilterValue = DefaultDateInterval.ToString();
RG_Lst_CS.Rebind();
}
}
"([CCE_DateReception]>=DateTime.Parse(\""+DefaultDateInterval+"\")) "
Is based on Current filter expression when i use the Build-in grid filter.
But I also try:
"([CCE_DateReception] >= \"" + DefaultDateInterval + "\" ) "
The Error occure on RG_Lst_CS.Rebind() or RG_Lst_CS.MasterTableView.Rebind()
And EnableLinqExpressions="true" do not look to do the trick.