Hello,
I build a class with Telerik Advices to custom filter date.
My RadFilter bind a RadGrid.
I can save filters in a sqlDataBase.
When I choose a value in my custom combo filter date : no problem.
I save it : no problem
I load it the same day : no problem
But if I load it the next day or after : I must select the value, again.
It is very restriction for users which save their filters.
Have you got an idea to find again my selected value ?
Anne
I build a class with Telerik Advices to custom filter date.
My RadFilter bind a RadGrid.
I can save filters in a sqlDataBase.
When I choose a value in my custom combo filter date : no problem.
I save it : no problem
I load it the same day : no problem
But if I load it the next day or after : I must select the value, again.
It is very restriction for users which save their filters.
Imports System Imports System.Collections.Generic Imports System.Linq Imports System.Web Imports Telerik.Web.UI Imports System.Collections 'ACB - V1.0 - 07 septembre 2010 ''' <summary> ''' filter on today or next days or last days''' </summary> ''' <remarks></remarks> Public Class DateFiltre Inherits RadFilterDataFieldEditor Protected Overrides Sub CopySettings(ByVal baseEditor As Telerik.Web.UI.RadFilterDataFieldEditor) MyBase.CopySettings(baseEditor) Dim editor = TryCast(baseEditor, DateFiltre) If editor IsNot Nothing Then StartDate = editor.StartDate End If End Sub Public Property StartDate() As System.Nullable(Of DateTime) Get Return m_StartDate End Get Set(ByVal value As System.Nullable(Of DateTime)) m_StartDate = value End Set End Property Private m_StartDate As System.Nullable(Of DateTime) Public Overrides Property DataType() As System.Type Get Return MyBase.DataType End Get Set(ByVal value As System.Type) MyBase.DataType = value End Set End Property Public Overrides Function ExtractValues() As System.Collections.ArrayList Dim list As New ArrayList() If combo.SelectedIndex = 0 Then list.Add(Nothing) Else list.Add(DateTime.Parse(combo.SelectedValue)) End If Return list End Function Private combo As RadComboBox Public Overrides Sub InitializeEditor(ByVal container As System.Web.UI.Control) Dim currentDate = If(StartDate, Date.Today) combo = New RadComboBox() combo.Items.Add(New RadComboBoxItem("select")) combo.Items.Add(New RadComboBoxItem("date+60", currentDate.AddDays(60).ToString())) combo.Items.Add(New RadComboBoxItem("date+21", currentDate.AddDays(21).ToString())) combo.Items.Add(New RadComboBoxItem("date+20", currentDate.AddDays(20).ToString())) combo.Items.Add(New RadComboBoxItem("date+15", currentDate.AddDays(15).ToString())) combo.Items.Add(New RadComboBoxItem("date+14", currentDate.AddDays(14).ToString())) combo.Items.Add(New RadComboBoxItem("date+10", currentDate.AddDays(10).ToString())) combo.Items.Add(New RadComboBoxItem("date+7", currentDate.AddDays(7).ToString())) combo.Items.Add(New RadComboBoxItem("date+5", currentDate.AddDays(5).ToString())) combo.Items.Add(New RadComboBoxItem("date+2", currentDate.AddDays(2).ToString())) combo.Items.Add(New RadComboBoxItem("date+1", currentDate.AddDays(1).ToString())) combo.Items.Add(New RadComboBoxItem("date", currentDate.ToString())) combo.Items.Add(New RadComboBoxItem("date-1", currentDate.AddDays(-1).ToString())) combo.Items.Add(New RadComboBoxItem("date-2", currentDate.AddDays(-2).ToString())) combo.Items.Add(New RadComboBoxItem("date-3", currentDate.AddDays(-3).ToString())) container.Controls.Add(combo) End Sub Public Overrides Sub SetEditorValues(ByVal values As System.Collections.ArrayList) If values(0) IsNot Nothing Then combo.SelectedValue = values(0).ToString End If End Sub End Class Have you got an idea to find again my selected value ?
Anne