How to config FileManager when using asp.net mvc 5?

Hi Team

I want to use this control to my asp.net mvc application, do i need to config them on web.config? Do all these control needs to be config on the application if show, any document i could use maybe step by step guid? For me that will be sufficient enough, never used this extension i am new to it. Once i get enough understanding then i should be solid enough to use others as well on my application.

5 Replies 1 reply marked as answer

SP Sowmiya Padmanaban Syncfusion Team October 20, 2020 12:28 PM UTC

Hi Gcobani,  
 
Greetings from Syncfusion support. 
 
We have checked your requirement to use FileManager component with MVC. Refer the below steps to render the Syncfusion component in your application. 
 
 
Refer to the below links to know more details about FileManager component. 
 
 
 
 
We have attached a sample with FileManager component in the below link for your reference.  
 
 
Please check the above links and let us know, if you need any further assistance. 
 
Regards,  
Sowmiya.P 



GC Gcobani October 20, 2020 12:35 PM UTC

Hi Somwiya

I strongly believe on every control, its important to have web.config being configured for application to load every reference used from the application? If so do you have similar links with Schedule? especially to configure this control on VS 2017-2019? It will help me a lot here, bit stuck


RV Ravikumar Venkatesan Syncfusion Team October 21, 2020 12:53 PM UTC

Hi Gcobani, 

Thanks for the update. 

We have validated your reported query at our end. For using the EJ2 MVC components in your project you need to configure the Web.config file located in your project directory “~/Views/Web.config” with the below-highlighted code. We have prepared a sample for your reference and it can be available below. 

[Web.config] 
<configuration> 
  <system.web.webPages.razor> 
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
    <pages pageBaseType="System.Web.Mvc.WebViewPage"> 
      <namespaces> 
        ... 
        ... 
        <add namespace="Syncfusion.EJ2"/> 
      </namespaces> 
    </pages> 
  </system.web.webPages.razor> 
 
  ... 
  ... 
 
  <system.web> 
    <compilation> 
      <assemblies> 
        ... 
        ... 
      <add assembly="Syncfusion.EJ2, Culture=neutral" /> 
      </assemblies> 
    </compilation> 
  </system.web> 
</configuration> 


Kindly refer to the below links for more reference and get back to us if you need any further assistance. 


Regards, 
Ravikumar Venkatesan


GC Gcobani October 21, 2020 01:03 PM UTC

Hi Team

I am trying to understand one thing, from this logic according to the sample i was give from the links

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ScheduleSample.Models;
using Syncfusion.EJ2.Schedule;

namespace ScheduleSample.Controllers
{
    public class HomeController : Controller
    {
        ScheduleDataDataContext db = new ScheduleDataDataContext();
        public ActionResult Index()
        {
            List<.> conferences = new List();
            conferences.Add(new ResourceDataSourceModel { text = "Margaret", id = 1, color = "#1aaa55" });
            conferences.Add(new ResourceDataSourceModel { text = "Robert", id = 2, color = "#357cd2" });
            conferences.Add(new ResourceDataSourceModel { text = "Laura", id = 3, color = "#7fa900" });
            ViewBag.Conferences = conferences;
            string[] resources = new string[] { "Conferences" };
            ViewBag.Resources = resources;
            return View();
        }
        public class ResourceDataSourceModel
        {
            public string text { set; get; }
            public int id { set; get; }
            public string color { set; get; }
        }

        public JsonResult LoadData(Params param)  // Here we get the Start and End Date and based on that can filter the data and return to Scheduler
        {
            DateTime start = param.StartDate;
            DateTime end = param.EndDate;
            var data = db.ScheduleEventDatas.Where(app => (app.StartTime >= start && app.StartTime <= end) || (app.RecurrenceRule != null && app.RecurrenceRule != "")).ToList();  // Here filtering the events based on the start and end date value.
            return Json(data, JsonRequestBehavior.AllowGet);
        }
        public class Params
        {
            public DateTime StartDate { get; set; }
            public DateTime EndDate { get; set; }
        }

        [HttpPost]
        public JsonResult UpdateData(  param)
        {
            if (param.action == "insert" || (param.action == "batch" && param.added != null)) // this block of code will execute while inserting the appointments
            {
                var value = (param.action == "insert") ? param.value : param.added[0];
                //int intMax = db.ScheduleEventDatas.ToList().Count > 0 ? db.ScheduleEventDatas.ToList().Max(p => p.Id) : 1;
                DateTime startTime = Convert.ToDateTime(value.StartTime);
                DateTime endTime = Convert.ToDateTime(value.EndTime);
                ScheduleEventData appointment = new ScheduleEventData()
                {
                    Id = Guid.NewGuid(),
                    StartTime = startTime.ToLocalTime(),
                    EndTime = endTime.ToLocalTime(),
                    Subject = value.Subject,
                    IsAllDay = value.IsAllDay,
                    StartTimezone = value.StartTimezone,
                    EndTimezone = value.EndTimezone,
                    RecurrenceRule = value.RecurrenceRule,
                    RecurrenceID = value.RecurrenceID,
                    RecurrenceException = value.RecurrenceException,
                    ConferenceId = value.ConferenceId
                };
                db.ScheduleEventDatas.InsertOnSubmit(appointment); // InsertOnSubmit=> where is it called?
                db.SubmitChanges(); // This method is called where, i am using entity framework mine should be SaveChanges(); I need some advice from these two comments
            }
            if (param.action == "update" || (param.action == "batch" && param.changed != null)) // this block of code will execute while updating the appointment
            {
                var value = (param.action == "update") ? param.value : param.changed[0];
                var filterData = db.ScheduleEventDatas.Where(c => c.Id == value.Id);
                if (filterData.Count() > 0)
                {
                    DateTime startTime = Convert.ToDateTime(value.StartTime);
                    DateTime endTime = Convert.ToDateTime(value.EndTime);
                    ScheduleEventData appointment = db.ScheduleEventDatas.Single(A => A.Id == (value.Id));
                    appointment.StartTime = startTime.ToLocalTime();
                    appointment.EndTime = endTime.ToLocalTime();
                    appointment.StartTimezone = value.StartTimezone;
                    appointment.EndTimezone = value.EndTimezone;
                    appointment.Subject = value.Subject;
                    appointment.IsAllDay = value.IsAllDay;
                    appointment.RecurrenceRule = value.RecurrenceRule;
                    appointment.RecurrenceID = value.RecurrenceID;
                    appointment.RecurrenceException = value.RecurrenceException;
                    appointment.ConferenceId = value.ConferenceId;
                }
                db.SubmitChanges();
            }
            if (param.action == "remove" || (param.action == "batch" && param.deleted != null)) // this block of code will execute while removing the appointment
            {
                if (param.action == "remove")
                {
                    ScheduleEventData appointment = db.ScheduleEventDatas.Where(c => c.Id == Guid.Parse(param.key)).FirstOrDefault();
                    if (appointment != null) db.ScheduleEventDatas.DeleteOnSubmit(appointment);
                }
                else
                {
                    foreach (var apps in param.deleted)
                    {
                        ScheduleEventData appointment = db.ScheduleEventDatas.Where(c => c.Id == apps.Id).FirstOrDefault();
                        if (apps != null) db.ScheduleEventDatas.DeleteOnSubmit(appointment);
                    }
                }
                db.SubmitChanges();
            }
            var data = db.ScheduleEventDatas.ToList();
            return Json(data, JsonRequestBehavior.AllowGet);
        }       

        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}


RV Ravikumar Venkatesan Syncfusion Team October 22, 2020 03:05 PM UTC

Hi Gcobani, 
  
Thanks for the update. 
  
We have validated your query at our end. The InsertOnSubmit method is used to add the new record to the DB. For the entity framework, you need to use the below equal codes mentioned in the below table instead of using InserOnSubmit, SubmitChanges, and DeleteOnSubmit
  
InsertOnSubmit 
Add 
SubmitChanges 
SaveChanges 
DeleteOnSubmit 
Remove 
  
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.Mvc; 
using ScheduleSample.Models; 
using Syncfusion.EJ2.Schedule; 
  
namespace ScheduleSample.Controllers 
    public class HomeController : Controller 
    { 
        ScheduleDataDataContext db = new ScheduleDataDataContext(); 
        public ActionResult Index() 
        { 
            List<.> conferences = new List(); 
            conferences.Add(new ResourceDataSourceModel { text = "Margaret", id = 1, color = "#1aaa55" }); 
            conferences.Add(new ResourceDataSourceModel { text = "Robert", id = 2, color = "#357cd2" }); 
            conferences.Add(new ResourceDataSourceModel { text = "Laura", id = 3, color = "#7fa900" }); 
            ViewBag.Conferences = conferences; 
            string[] resources = new string[] { "Conferences" }; 
            ViewBag.Resources = resources; 
            return View(); 
        } 
        public class ResourceDataSourceModel 
        { 
            public string text { set; get; } 
            public int id { set; get; } 
            public string color { set; get; } 
        } 
  
        public JsonResult LoadData(Params param)  // Here we get the Start and End Date and based on that can filter the data and return to Scheduler 
        { 
            DateTime start = param.StartDate; 
            DateTime end = param.EndDate; 
            var data = db.ScheduleEventDatas.Where(app => (app.StartTime >= start && app.StartTime <= end) || (app.RecurrenceRule != null && app.RecurrenceRule != "")).ToList(); 
            return Json(data, JsonRequestBehavior.AllowGet); 
        } 
        public class Params 
        { 
            public DateTime StartDate { get; set; } 
            public DateTime EndDate { get; set; } 
        } 
  
        [HttpPost] 
        public JsonResult UpdateData(  param) 
        { 
            if (param.action == "insert" || (param.action == "batch" && param.added != null)) // this block of code will execute while inserting the appointments 
            { 
                var value = (param.action == "insert") ? param.value : param.added[0]; 
                //int intMax = db.ScheduleEventDatas.ToList().Count > 0 ? db.ScheduleEventDatas.ToList().Max(p => p.Id) : 1; 
                DateTime startTime = Convert.ToDateTime(value.StartTime); 
                DateTime endTime = Convert.ToDateTime(value.EndTime); 
                ScheduleEventData appointment = new ScheduleEventData() 
                { 
                    Id = Guid.NewGuid(), 
                    StartTime = startTime.ToLocalTime(), 
                    EndTime = endTime.ToLocalTime(), 
                    Subject = value.Subject, 
                    IsAllDay = value.IsAllDay, 
                    StartTimezone = value.StartTimezone, 
                    EndTimezone = value.EndTimezone, 
                    RecurrenceRule = value.RecurrenceRule, 
                    RecurrenceID = value.RecurrenceID, 
                    RecurrenceException = value.RecurrenceException, 
                    ConferenceId = value.ConferenceId 
                }; 
                db.ScheduleEventDatas. Add(appointment); 
                db.SaveChanges(); 
            } 
            if (param.action == "update" || (param.action == "batch" && param.changed != null)) // this block of code will execute while updating the appointment 
            { 
                var value = (param.action == "update") ? param.value : param.changed[0]; 
                var filterData = db.ScheduleEventDatas.Where(c => c.Id == value.Id); 
                if (filterData.Count() > 0) 
                { 
                    DateTime startTime = Convert.ToDateTime(value.StartTime); 
                    DateTime endTime = Convert.ToDateTime(value.EndTime); 
                    ScheduleEventData appointment = db.ScheduleEventDatas.Single(A => A.Id == (value.Id)); 
                    appointment.StartTime = startTime.ToLocalTime(); 
                    appointment.EndTime = endTime.ToLocalTime(); 
                    appointment.StartTimezone = value.StartTimezone; 
                    appointment.EndTimezone = value.EndTimezone; 
                    appointment.Subject = value.Subject; 
                    appointment.IsAllDay = value.IsAllDay; 
                    appointment.RecurrenceRule = value.RecurrenceRule; 
                    appointment.RecurrenceID = value.RecurrenceID; 
                    appointment.RecurrenceException = value.RecurrenceException; 
                    appointment.ConferenceId = value.ConferenceId; 
                } 
                db.SaveChanges(); 
            } 
            if (param.action == "remove" || (param.action == "batch" && param.deleted != null)) // this block of code will execute while removing the appointment 
            { 
                if (param.action == "remove") 
                { 
                    ScheduleEventData appointment = db.ScheduleEventDatas.Where(c => c.Id == Guid.Parse(param.key)).FirstOrDefault(); 
                    if (appointment != null) db.ScheduleEventDatas.Remove(appointment)
                } 
                else 
                { 
                    foreach (var apps in param.deleted) 
                    { 
                        ScheduleEventData appointment = db.ScheduleEventDatas.Where(c => c.Id == apps.Id).FirstOrDefault(); 
                        if (apps != null) db.ScheduleEventDatas. Remove (appointment)
                    } 
                } 
                db.SaveChanges(); 
            } 
            var data = db.ScheduleEventDatas.ToList(); 
            return Json(data, JsonRequestBehavior.AllowGet); 
        }        
  
        public ActionResult About() 
        { 
            ViewBag.Message = "Your application description page."; 
  
            return View(); 
        } 
  
        public ActionResult Contact() 
        { 
            ViewBag.Message = "Your contact page."; 
  
            return View(); 
        } 
    } 
  
Please let us know if you need any further assistance. 
  
Regards, 
Ravikumar Venkatesan 


Marked as answer
Loader.
Up arrow icon