I have a UI which needs filtering activated.
The scrum story reads, "As a user I want to filter grid rows using calendar controls to select a start date and an end date."
There are two columns in the grid: Job Start, and Job End. I need to apply the following filter logic:
JobStart >= calendarStartDate AND JobEnd < calendarEndDate.
The routine executes in the event handler of the "apply filter" button.
Can someone please tell me what I am doing wrong?
| protected void UpdateButton_OnClick(object sender, EventArgs args) |
| { |
| //First attempt was to directly edit the filter expression |
| //this._jobReportsSummaryGrid.Grid.MasterTableView.FilterExpression = string.Format("[JobStart] >= '{0}' AND [JobEnd] < '{1}'", _startDateCalendar.SelectedDate, _endDateCalendar.SelectedDate); |
| //When that didn't work I added this |
| this._jobReportsSummaryGrid.Grid.AllowFilteringByColumn = true; |
| GridColumn JobStartColumn = this._jobReportsSummaryGrid.Grid.MasterTableView.GetColumnSafe("JobStart"); |
| JobStartColumn.CurrentFilterFunction = GridKnownFunction.GreaterThanOrEqualTo; |
| JobStartColumn.CurrentFilterValue = _startDateCalendar.SelectedDate.Value.Date.ToString("MM/dd/yyyy"); |
| GridColumn JobEndColumn = this._jobReportsSummaryGrid.Grid.MasterTableView.GetColumnSafe("JobEnd"); |
| JobEndColumn.CurrentFilterFunction = GridKnownFunction.LessThan; |
| JobEndColumn.CurrentFilterValue = _startDateCalendar.SelectedDate.Value.Date.ToString("MM/dd/yyyy"); |
| //...and when that didn't work, I came here |
| } |