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

Grid filtering issue

0 Answers 15 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Pierre asked on 30 Nov 2016, 12:38 PM

I am adding a default initial filter from the code-behind, but I'm getting an error:


  • 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" >
      <telerik:GridDateTimeColumn DataField="CCE_DateReception" HeaderText="Date Reception"
                         DataType="System.DateTime" DataFormatString="{0:d}" />

  • 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();

"([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.

No answers yet. Maybe you can help?

Asked by
Top achievements
Rank 1
Share this question