Imports System.Web.UI
Imports System.Collections
Namespace UI.WebControls.AdHocQuery
<ToolboxData("<{0}:AdHocQueryFilter />")> _
Public Class AdHocQueryFilter
Implements IStateManager
Private m_IsTrackingViewState As Boolean
Private m_ViewState As StateBag
<PersistenceMode(PersistenceMode.Attribute)> _
<System.ComponentModel.NotifyParentProperty(True)> _
Public Property DisplayName() As String
Get
Dim value As Object = ViewState("DisplayName")
Return IIf(value IsNot Nothing, value, String.Empty)
End Get
Set(ByVal value As String)
ViewState("DisplayName") = value
End Set
End Property
<PersistenceMode(PersistenceMode.Attribute)> _
<System.ComponentModel.NotifyParentProperty(True)> _
Public Property FieldName() As String
Get
Dim value As Object = ViewState("FieldName")
Return IIf(value IsNot Nothing, value, String.Empty)
End Get
Set(ByVal value As String)
ViewState("FieldName") = value
End Set
End Property
<PersistenceMode(PersistenceMode.Attribute)> _
<System.ComponentModel.NotifyParentProperty(True)> _
Public Property DataType() As System.TypeCode
Get
Dim value As Object = ViewState("DataType")
Return IIf(value IsNot Nothing, value, TypeCode.Empty)
End Get
Set(ByVal value As System.TypeCode)
ViewState("DataType") = value
End Set
End Property
Public Sub SetDirty()
Me.ViewState.SetDirty(True)
End Sub
Protected Overridable ReadOnly Property ViewState() As StateBag
Get
If m_ViewState Is Nothing Then
m_ViewState = New StateBag(False)
If m_IsTrackingViewState Then
DirectCast(m_ViewState, IStateManager).TrackViewState()
End If
End If
Return m_ViewState
End Get
End Property
<System.ComponentModel.Browsable(False)> _
Public ReadOnly Property IsTrackingViewState() As Boolean Implements System.Web.UI.IStateManager.IsTrackingViewState
Get
Return m_IsTrackingViewState
End Get
End Property
Public Sub LoadViewState(ByVal state As Object) Implements System.Web.UI.IStateManager.LoadViewState
If state IsNot Nothing Then
DirectCast(ViewState, IStateManager).LoadViewState(state)
End If
End Sub
Public Function SaveViewState() As Object Implements System.Web.UI.IStateManager.SaveViewState
Dim retval As Object = Nothing
If m_ViewState IsNot Nothing Then
retval = DirectCast(m_ViewState, IStateManager).SaveViewState
End If
Return retval
End Function
Public Sub TrackViewState() Implements System.Web.UI.IStateManager.TrackViewState
m_IsTrackingViewState = True
If m_ViewState IsNot Nothing Then
DirectCast(m_ViewState, IStateManager).TrackViewState()
End If
End Sub
End Class
End Namespace