Private property resets on userControl

2 posts, 0 answers
  1. Daniel
    Daniel avatar
    16 posts
    Member since:
    Jun 2013

    Posted 23 Jun 2013 Link to this post

    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.







  2. Daniel
    Daniel avatar
    16 posts
    Member since:
    Jun 2013

    Posted 23 Jun 2013 Link to this post

    Of course web architecture is state less. Solved adding data to ViewState.
Back to Top