O
Owen
Firstly, if this is the wrong newsgroup for my question, please direct me
elswhere and accept my apologies! It's a question about ASP.NET but also
uses VB.NET classes.
This is a little strange, but I feel I'm missing an obvious answer. Perhaps
you guru's can enlighten me?
I have webform. I also have a class, which includes the following
declaration and property:
____________
Protected _IRWKeyMilestones as IRWKeyMilestones
Public Property IRWKeyMilestones() As IRWKeyMilestones
Get
If _IRWKeyMilestones Is Nothing Then
_IRWKeyMilestones = New IRWKeyMilestones(Cascade, Me)
End If
Return _IRWKeyMilestones
End Get
Set(ByVal Value As IRWKeyMilestones)
_IRWKeyMilestones = Value
End Set
End Property
____________
The IRWKeyMilestones class is marked "<Serialisable()>" and inherits the
..net "Collection" class.
The IRWKeyMilestones collection is populated via the web form, that's not
important right now. When I refer to "IRWKeyMilestones" elsewhere in the
code, it gets it nicely from the above property as expected. And when I
change an IRWKeyMilestones item, it updates the collection nicely. So far,
so good.
I have a "Save" button on my web form, which calls a "Save" method, which
saves the collection to the database. Again, the details of that aren't
imporant right now. The point is, it works fine and the _IRWKeyMilestones
collection is persisted upon postback of the form.
Now, the problem:
I have another button, totally unrelated, elsewhere on my webform. This
button also causes a postback - to update other parts of the page. BUT
when this particular postback happens, it seems to obliterate
_IRWKeyMilestones; it sets it to Nothing. So all changes to the collection
are lost. I remind you, IRWKeyMilestones is *totally unrelated* to the
button being pressed.
Can anyone think of an obvious reason why _IRWKeyMilestones isn't being
persisted in the second instance? I thought putting "Protected" in front
of it was enough? Obviously not.
Help !
Thanks,
Owen
PS. replies cc'd via email appreciated
(e-mail address removed)
elswhere and accept my apologies! It's a question about ASP.NET but also
uses VB.NET classes.
This is a little strange, but I feel I'm missing an obvious answer. Perhaps
you guru's can enlighten me?
I have webform. I also have a class, which includes the following
declaration and property:
____________
Protected _IRWKeyMilestones as IRWKeyMilestones
Public Property IRWKeyMilestones() As IRWKeyMilestones
Get
If _IRWKeyMilestones Is Nothing Then
_IRWKeyMilestones = New IRWKeyMilestones(Cascade, Me)
End If
Return _IRWKeyMilestones
End Get
Set(ByVal Value As IRWKeyMilestones)
_IRWKeyMilestones = Value
End Set
End Property
____________
The IRWKeyMilestones class is marked "<Serialisable()>" and inherits the
..net "Collection" class.
The IRWKeyMilestones collection is populated via the web form, that's not
important right now. When I refer to "IRWKeyMilestones" elsewhere in the
code, it gets it nicely from the above property as expected. And when I
change an IRWKeyMilestones item, it updates the collection nicely. So far,
so good.
I have a "Save" button on my web form, which calls a "Save" method, which
saves the collection to the database. Again, the details of that aren't
imporant right now. The point is, it works fine and the _IRWKeyMilestones
collection is persisted upon postback of the form.
Now, the problem:
I have another button, totally unrelated, elsewhere on my webform. This
button also causes a postback - to update other parts of the page. BUT
when this particular postback happens, it seems to obliterate
_IRWKeyMilestones; it sets it to Nothing. So all changes to the collection
are lost. I remind you, IRWKeyMilestones is *totally unrelated* to the
button being pressed.
Can anyone think of an obvious reason why _IRWKeyMilestones isn't being
persisted in the second instance? I thought putting "Protected" in front
of it was enough? Obviously not.
Help !
Thanks,
Owen
PS. replies cc'd via email appreciated
(e-mail address removed)