We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Get Data from Sql server database and bind to schedule control

Thread ID:

Created:

Updated:

Platform:

Replies:

120516 Sep 22,2015 07:55 AM Sep 23,2015 06:13 AM ASP.NET MVC 1
loading
Tags: Schedule
saravanan
Asked On September 22, 2015 07:55 AM

Hi,
       I have used the below code to get the data.

       public ActionResult GetData()
        {
            IEnumerable data = new ScheduleDataContext().DefaultSchedules.Take(2);
            return Json(data, JsonRequestBehavior.AllowGet);
        }

     I have placed the GetData method in the controller named Schedule.

    And the .cshtml code is as follows.

    $(function () {

     var localServ = "/Schedule/GetData";

     var dManager = ej.DataManager({

     url: localServ,

     crudUrl: "/Schedule/CRUD"                // Here you have to pass the post action name for the crud operation

     });

     dManager.adaptor = new ej.UrlAdaptor();

     var query = ej.Query().from("DefaultSchedules");//.select("id,Subject,Location,StartTime,EndTime,Description,Categorize,AllDay");

$("#Schedule1").ejSchedule({

     enableAppointmentNavigation: false,

     currentDate: new Date(2015, 9, 22),

     appointmentSettings: {

     dataSource: dManager,

     tableName: "DefaultSchedules",

     query: query,

     id: "Id",

     subject: "Subject",

     //location: "Location",

     description: "Description",

     startTime: "StartTime",

     endTime: "EndTime",

     allDay: "AllDay",

     recurrence: "Recurrence",

     recurrenceRule: "RecurrenceRule"

     }

 });

});

     @(Html.EJ().Schedule("Schedule1")
     .Width("100%")
     .Height("525px")
     .AppointmentSettings(fields => fields.Datasource(ds => ds.URL("Schedule/GetData").Adaptor("UrlAdaptor"))
     .Id("Id")
     .Subject("Subject")
     .Description("Description")
     .StartTime("StartTime")
     .EndTime("EndTime")
     .AllDay("AllDay")
     .Recurrence("Recurrence")
     .RecurrenceRule("RecurrenceRule"))
     )

when i run the application, the browser shows the json data as below

[{"Id":1,"Subject":"Test Appointment","Description":"Test Appointment","StartTime":"\/Date(1442910600000)\/","EndTime":"\/Date(1442914200000)\/","AllDay":false,"Recurrence":false,"RecurrenceRule":"Test"}]
but the scheduler control is not visible. could you please tell me what changes needs to be done to get the appointment data bind to scheduler control ?




  

Sarath Kumar P K [Syncfusion]
Replied On September 23, 2015 06:13 AM

Hi Saravanan,

Thanks for contacting Syncfusion support.

We have analyzed your reported issue with your code example. We suspect that you don’t have any appointments on the date schedule render initially. We request you to check the appointment data for a particular date in scheduler and to see the appointments. We have prepared a schedule sample to get the data from SQL and bind it to scheduler and it can be downloaded from the following location:
http://www.syncfusion.com/downloads/support/forum/120516/ze/ScheduleCRUD-1851262232

In the above sample we have appointments on date 10, 11, 12 and 14 August 2015.

Regards,
Sarath Kumar P K

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;