using System; using System.Collections; using System.Data; using System.Data.SqlClient; using DayPilot.Web.Ui.Enums; using DayPilot.Web.Ui.Events; using DayPilot.Web.Ui.Events.Bubble; using DayPilot.Web.Ui.Events.Calendar; using System.Configuration; using DayPilot.Web.Ui.Events.Navigator; public partial class WebFormAdmin_GoogleLike : System.Web.UI.Page { private DataTable table; int i= 0; MeetingDAL objMeetingDAL = new MeetingDAL(); private string Name; protected void Page_Load(object sender, EventArgs e) { //#region Data loading initialization //if (Session["AllFeatures"] == null) //{ // Session["AllFeatures"] = DataGeneratorCalendar.GetData(); //} //table = (DataTable)Session["AllFeatures"]; //DayPilotCalendar1.DataSource = Session["AllFeatures"]; ////DayPilotNavigator1.DataSource = Session["AllFeatures"]; //#endregion if (!IsPostBack) { DayPilotCalendar1.StartDate = DayPilot.Utils.Week.FirstDayOfWeek(); DayPilotCalendar1.DataSource = dbGetEvents(DayPilotCalendar1.StartDate,DayPilotCalendar1.Days); DataBind(); } } private DataTable dbGetEvents(DateTime d, int day) { SqlDataAdapter adap = new SqlDataAdapter("Select [MeetingId], [Meeting Name],[startdate],[enddate] from SampleMeeting", ConfigurationManager.ConnectionStrings["SKSConnString"].ConnectionString); adap.SelectCommand.Parameters.AddWithValue("start", d); adap.SelectCommand.Parameters.AddWithValue("end", d.AddDays(day)); DataTable dt = new DataTable(); adap.Fill(dt); return dt; } protected void DayPilotCalendar1_BeforeHeaderRender(object sender, BeforeHeaderRenderEventArgs e) { } protected void DayPilotCalendar1_Command(object sender, CommandEventArgs e) { switch (e.Command) { case "previous": DayPilotCalendar1.StartDate = DayPilotCalendar1.StartDate.AddDays(-7); DayPilotCalendar1.DataBind(); DayPilotCalendar1.Update(CallBackUpdateType.Full); break; case "navigate": DateTime start = (DateTime)e.Data["start"]; DateTime end = (DateTime)e.Data["end"]; DayPilotCalendar1.StartDate = start; DayPilotCalendar1.DataSource = dbGetEvents(DayPilotCalendar1.StartDate, DayPilotCalendar1.Days); DayPilotCalendar1.DataBind(); // DayPilotCalendar1.DataBind(); DayPilotCalendar1.Update(DayPilot.Web.Ui.Enums.CallBackUpdateType.Full); break; case "refresh": DayPilotCalendar1.DataBind(); DayPilotCalendar1.Update(); break; } } protected void DayPilotNavigator1_VisibleRangeChanged(object sender, DayPilot.Web.Ui.Events.Navigator.VisibleRangeChangedEventArgs e) { //DayPilotNavigator1.DataSource = dbGetEvents(DayPilotCalendar1.StartDate, DayPilotCalendar1.Days); int days = (int)(DayPilotNavigator1.VisibleEnd - DayPilotNavigator1.VisibleStart).TotalDays; DayPilotNavigator1.DataSource = dbGetEvents(DayPilotNavigator1.VisibleStart, days); DayPilotNavigator1.DataBind(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)