Scheduler postback problem

4 posts, 0 answers
  1. Andy Green
    Andy Green avatar
    120 posts
    Member since:
    Jul 2009

    Posted 18 Aug 2009 Link to this post

    Hi All

    I have a user control containing a scheduler in the ascx pageload event I get all the data for the scheduler

     

    If Not Page.IsPostBack Then

     

    LoadSessions(JobPlan_ID, Cycle)

     

    Me.lblCycle.Text = "Week " & Cycle

     

     

    End If

     


    The control is called from my aspx which loops to create the correct number of instance on the control (The Load Session()).
    If Not Page.IsPostBack Then

     

    LoadWeeks()

     

    End If

     


    I'm having trouble maintaining state across postbacks.

    Using the page loads as shown whenever I do a postbask the controls disappear, if I move the loader outside of the page.ispostback code then they appear but as expected I loos all user completed fields (on a separate edit area)

    What am I doing wrong?

    Andy
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 19 Aug 2009 Link to this post

    Hi Andy,

    This is a common problem when loading user controls dynamically. You can use Session or Viewstate as a workaround. Here is a helpful article for reference:
    http://bytes.com/topic/asp-net/answers/295002-viewstate-dynamic-usercontrols-back-button


    Best wishes,
    Peter
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Andy Green
    Andy Green avatar
    120 posts
    Member since:
    Jul 2009

    Posted 20 Aug 2009 Link to this post

    Hi Peter

    Thanks for the link, but it doesn't help much. It gives 2 high level approches (no details on fix)  for users hitting the back button. I'm just doing a postback, and there are no clues on how to store the schedulers details in the viewstate. my problem is that if I hide the initial scheduler set up inside an 'If not  page.ispostback' the contol is not recreated from the viewstate data following a postback.

    ANdy

  5. Andy Green
    Andy Green avatar
    120 posts
    Member since:
    Jul 2009

    Posted 20 Aug 2009 Link to this post

    Hi

    I've fixed this, but not sure if its the best way.

    I've got it working by calling the schedule loader function on each postback  from the sub routines that are called on postback.

    If there is a better way could someone let me know.

    Andy

Back to Top