protected override void SetCurrentFilterValueToControl(TableCell cell) { try { //SetCurrentFilterValueFromFilterExpression(); if (((IndCatGrid)this.Owner.OwnerGrid).IndFilterItem != null) { IndFilterItem indFilterItem = ((IndCatGrid)this.Owner.OwnerGrid).IndFilterItem; if (indFilterItem.FilterValues.ContainsKey(this.UniqueName)) { this.CurrentFilterValue = indFilterItem.FilterValues[this.UniqueName].ToString(); } } base.SetCurrentFilterValueToControl(cell); if (cell.Controls.Count > 2) { if (cell.Controls[1] is DropDownList) { DropDownList ddlBoolFilter = cell.Controls[1] as DropDownList; if (this.CurrentFilterValue != String.Empty) { ddlBoolFilter.SelectedValue = this.CurrentFilterValue; } } if (cell.Controls[1] is IndDatePicker) { IndDatePicker datePicker = cell.Controls[1] as IndDatePicker; if (!String.IsNullOrEmpty(this.CurrentFilterValue)) { datePicker.SelectedDate = DateTime.Parse(this.CurrentFilterValue); } } } } catch (IndException ex) { ControlHierarchyManager.ReportError(ex); return; } catch (Exception ex) { ControlHierarchyManager.ReportError(new IndException(ex)); return; } }
private void FilterCommonColumn(IndGridBoundColumn col, string value, IndFilterItem filterItem, string comparerStart, string comparerEnd, GridKnownFunction function) { if (String.IsNullOrEmpty(value)) { col.CurrentFilterFunction = function; col.CurrentFilterValue = value; return; } if (filterItem.FilterExpression.Length == 0) { filterItem.FilterExpression.Append("([" + col.UniqueName + "] " + comparerStart + value + comparerEnd); } else { filterItem.FilterExpression.Append(" AND [" + col.UniqueName + "] " + comparerStart + value + comparerEnd); } col.CurrentFilterFunction = function; col.CurrentFilterValue = value.Replace("''", "'"); filterItem.FilterValues.Add(col.UniqueName, value.Replace("''", "'")); }
private void FilterSpecialColumn(IndGridBoundColumn col, IndFilterItem filterItem, string comparerStart, string comparerEnd, GridKnownFunction function) { if (col.Cell.Controls[1] is DropDownList) { DropDownList d = (DropDownList)col.Cell.Controls[1]; if (filterItem.FilterExpression.Length == 0) { filterItem.FilterExpression.Append("([" + col.UniqueName + "] " + comparerStart + ((d.SelectedValue == "All") ? String.Empty : d.SelectedValue) + comparerEnd); } else { filterItem.FilterExpression.Append(" AND [" + col.UniqueName + "] " + comparerStart + ((d.SelectedValue == "All") ? String.Empty : d.SelectedValue) + comparerEnd); } col.CurrentFilterFunction = function; col.CurrentFilterValue = ((d.SelectedValue == "All") ? String.Empty : d.SelectedValue); filterItem.FilterValues.Add(col.UniqueName, (d.SelectedValue == "All") ? String.Empty : d.SelectedValue); } if (col.Cell.Controls[1] is IndDatePicker) { IndDatePicker datePicker = (IndDatePicker)col.Cell.Controls[1]; if (datePicker.SelectedDate != null) { if (filterItem.FilterExpression.Length == 0) { filterItem.FilterExpression.Append("([" + col.UniqueName + "] >= '" + ((DateTime)datePicker.SelectedDate).ToShortDateString() + " 00:00:00.000' AND " + "[" + col.UniqueName + "] <= '" + ((DateTime)datePicker.SelectedDate).ToShortDateString() + " 23:59:59.999'"); } else { filterItem.FilterExpression.Append(" AND [" + col.UniqueName + "] >= '" + ((DateTime)datePicker.SelectedDate).ToShortDateString() + " 00:00:00.000' AND " + "[" + col.UniqueName + "] <= '" + ((DateTime)datePicker.SelectedDate).ToShortDateString() + " 23:59:59.999'"); } } col.CurrentFilterFunction = function; col.CurrentFilterValue = (datePicker.SelectedDate != null) ? ((DateTime)datePicker.SelectedDate).ToShortDateString() : null; filterItem.FilterValues.Add(col.UniqueName, (datePicker.SelectedDate != null) ? ((DateTime)datePicker.SelectedDate).ToShortDateString() : String.Empty); } }