RadAjaxPanel fails silently adding entity to viewstate

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

    Posted 17 Jul 2013 Link to this post

    I explain my issue, in a webform I can add entries to viewstate without problems through my userControl, sample:

    Public Property ItemId As Integer?
        Get
            Return Me.ViewState("Id")
        End Get
        Set(value As Integer?)
            Me.ViewState.Add("Id", value) 
        End Set
    End Property

    But, if this entry is a dbcontext not attached entity, RadAjaxPanel seems to be affected. Sample code adding entity:

    Public Property ItemId As Integer?
        Get
            Return Me.ViewState("Id")
        End Get
        Set(value As Integer?)
            Me.ViewState.Add("Id", value)
            Dim ctx = MyEntityContext
            ctx.Configuration.ProxyCreationEnabled = False
            Dim item = ctx.SomeCollection.find( value )
            Me.ViewState.Add("item", item)
        End Set
    End Property

    After adding 'item' to viewstate RadAjaxPanel don't respond, for example making visible or changing values to RadTextBox or other controls.

    I have make a lot of tests, I can store into ViewState all kind of objects, for example, I have tested with new String() { "a", "b" } and all runs perfectly but storing detached entity.

    Somebody know what this happens? Also, somebody has a workaround to store dbcontext simple entity through posts?

    Regards

     
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 22 Jul 2013 Link to this post

    Hi Daniel,

    In order to easily isolate the issue could you please share of the same scenario works correctly in case the RadAjaxPanel is removed from the page? Also could you please test the same with regular asp UpdatePanel instead of RadAjaxPanel and let us now if the result is the same?

    Regards,
    Maria Ilieva
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. Daniel
    Daniel avatar
    16 posts
    Member since:
    Jun 2013

    Posted 23 Jul 2013 Link to this post

    Hello Maria,

    thanks about your suggestion. Tested and UpdatePanel also fails silently.

    Any new suggestion to isolate this issue are welcome.

    regards,
    daniel.
  4. Answer
    Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 26 Jul 2013 Link to this post

    Hello Daniel,

    It appears that the issue is a general framework behaviour which is not directly related to our controls. however in your case I would suggest you ti use Session to keep the EntityFramework objects when Ajax request is used instead of the ViewState.

    Regards,
    Maria Ilieva
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top