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

Scheduler postback problem

3 Answers 71 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Andy Green
Top achievements
Rank 1
Andy Green asked on 18 Aug 2009, 12:44 PM
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

3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 19 Aug 2009, 04:07 PM
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.
0
Andy Green
Top achievements
Rank 1
answered on 20 Aug 2009, 06:42 AM
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

0
Andy Green
Top achievements
Rank 1
answered on 20 Aug 2009, 07:14 AM
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

Tags
Scheduler
Asked by
Andy Green
Top achievements
Rank 1
Answers by
Peter
Telerik team
Andy Green
Top achievements
Rank 1
Share this question
or