RadScheduler and ViewState

4 posts, 0 answers
  1. René De Blois
    René De Blois avatar
    5 posts
    Member since:
    Mar 2006

    Posted 22 Aug 2007 Link to this post

    I have a problem when I disable the viewState for the RadScheduler.  I know it's not safe doing that but I want my page to be as light as possible. 

    In the Page_load event, I load appointments from a database (on Init and Postback).  The problem I have is that I cannot retreive the new appointments in the scheduler after a postback.  If I check the Appointments collection, I don't have the new ones.

    Can someone explain why I lost the new ones ?  I was thinking that it's on the LoadPostData that you retreive the new data from the control.  Do I miss something ?

        protected void Page_Load(object sender, EventArgs e)
        {
          // Check AppointmentCollection.  Always o element inside.
          AppointmentCollection appointments = RadScheduler1.Appointments;

          // Load Appointment
          DateTime now = DateTime.UtcNow;
          now = new DateTime(now.Year, now.Month, now.Day, now.Hour, 0, 0);
          List<AppointmentInfo> appointments = new List<AppointmentInfo>();

          appointments.Add(new AppointmentInfo("Programmer le scheduler", now, now.AddHours(1)));

          RadScheduler1.DataKeyField = "ID";
          RadScheduler1.DataSubjectField = "Subject";
          RadScheduler1.DataStartField = "Start";
          RadScheduler1.DataEndField = "End";
          RadScheduler1.DataSource = appointments;
        }

  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 23 Aug 2007 Link to this post

    Hello René,

    This behavior can be expected, as RadScheduler has neither declarative data source nor provider that it can use to propagate the changes back to the data source. In such scenario, the changes remain only in the Appointments collection, that is saved in the ViewState, so they are lost indeed. In order to support such scenario, we have provided events, that you can attach to in order to update your data source. Please, take a look at the example that demonstrates.

    Greetings,
    Tsvetomir Tsonev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jagat
    Jagat avatar
    135 posts
    Member since:
    Jan 2011

    Posted 04 Mar in reply to T. Tsonev Link to this post

    That example link does not work. Can you update it?

     

    Thanks

  5. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 07 Mar Link to this post

    Hello Jagat,

    The topic discussed in this thread is regarding our Classic controls, which are not longer supported. The link in question, showcases a demo, where biding to a Generic List approach is demonstrated. You can observe this implementation in the following online demo:

    http://demos.telerik.com/aspnet-ajax/scheduler/examples/bindtolist/defaultcs.aspx


    Regards,
    Nencho
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top