Persisting Collection in Component

Discussion in 'ASP .Net Building Controls' started by Shawn B., Oct 4, 2004.

  1. Shawn B.

    Shawn B. Guest

    I have a component that derives from "Component" but I cannot make a
    collection property persist, it always loses its state next time I eneter
    the page or rebuild the project...


    -----------

    Imports System.ComponentModel

    Imports System.Web.UI.Design
    Imports System.Web.UI.Design.WebControls

    Imports System.Web
    Imports system.Web.UI
    Imports System.Web.UI.WebControls


    <ToolboxItem(True)> _
    Public NotInheritable Class XmlRulesValidator
    Inherits System.ComponentModel.Component

    #Region " Component Designer generated code "

    Public Sub New(ByVal Container As System.ComponentModel.IContainer)
    MyClass.New()

    'Required for Windows.Forms Class Composition Designer support
    Container.Add(Me)
    End Sub

    Public Sub New()
    MyBase.New()

    'This call is required by the Component Designer.
    InitializeComponent()

    'Add any initialization after the InitializeComponent() call

    End Sub

    'Component overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    If disposing Then
    If Not (components Is Nothing) Then
    components.Dispose()
    End If
    End If
    MyBase.Dispose(disposing)
    End Sub

    'Required by the Component Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Component Designer
    'It can be modified using the Component Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub
    InitializeComponent()
    components = New System.ComponentModel.Container()
    End Sub

    #End Region

    Private _defaultRulesFile As String =
    "/universal_validation/validation_rules.xml"
    Private _rules As XmlRuleCollection


    <Category("Behavior")> _
    Public Property DefaultRulesFile() As String
    Get
    Return _defaultRulesFile
    End Get
    Set(ByVal Value As String)
    _defaultRulesFile = Value
    End Set
    End Property

    < _
    Category("Behavior"), _
    DesignerSerializationVisibility(DesignerSerializationVisibility.Content)
    _
    > _

    Public ReadOnly Property Rules() As XmlRuleCollection
    Get
    If (_rules Is Nothing) Then
    _rules = New XmlRuleCollection()
    End If

    Return _rules
    End Get
    End Property

    End Class
     
    Shawn B., Oct 4, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. john_teague

    persisting collection in a custom datagrid

    john_teague, Dec 6, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    400
    john_teague
    Dec 6, 2005
  2. john_teague

    persisting collection in a custom datagrid

    john_teague, Dec 6, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    337
    john_teague
    Dec 6, 2005
  3. Øyvind Isaksen
    Replies:
    1
    Views:
    980
    Øyvind Isaksen
    May 18, 2007
  4. Persisting a collection property in a custom datagrid

    , Dec 5, 2005, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    109
  5. Replies:
    1
    Views:
    292
    Tim Dot NoSpam
    May 19, 2006
Loading...

Share This Page