This is a migrated thread and some comments may be shown as answers.

Private property resets on userControl

1 Answer 33 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 23 Jun 2013, 02:57 PM
In a form aspx page I have some controls as embedded userControl. This is as I include userControl :

<telerik:RadAjaxPanel ID="RadAjaxPanel000" runat="server" LoadingPanelID="RadAjaxLoadingPanel000">  
...
  <ardc:MyDataFormCtrl runat="server" ID="MyDataCtrl1" />


I set an entity to a property control from vb.aspx code:

Dim myEntityData= ctx.AnualitatsDeRecerca.Where(Function(x) x.Id = ... ).FirstOrDefault()
MyDataCtrl1.Item = myEntityData


All runs well because data is displayed on navigator:

Public Property Item As MyEntityType
    Get ...
    Set(value As MyEntityType)
        _item = value
        txtDescription.Text = Item.someItemData
    End Set
End Property


Problem appears when 'save' button is pushed, there, my private _item is Nothing:

Private Sub ButtonItemSave_Click(sender As Object, e As System.EventArgs) Handles ButtonItemSave.Click
    'here Me.Item, also, me._item, is Nothing!! what happens?


How can I do to keep Me.Item (and Me._item) populated?
Sorry, perhaps question is not enough detailed, I have include relevant code, ask for more details if needed.







1 Answer, 1 is accepted

Sort by
0
Daniel
Top achievements
Rank 1
answered on 23 Jun 2013, 08:32 PM
Of course web architecture is state less. Solved adding data to ViewState.
Tags
General Discussions
Asked by
Daniel
Top achievements
Rank 1
Answers by
Daniel
Top achievements
Rank 1
Share this question
or