Click here to Skip to main content
15,878,959 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
GoogleLike.aspx.cs
C#
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();
    }

   
 
}
Posted
Updated 10-Oct-13 1:01am
v2
Comments
Sriram Ramachandran 10-Oct-13 6:36am    
My Corresponding aspx file

<%@ Page Language="C#" MasterPageFile="~/MasterKitchen.master" AutoEventWireup="true"
CodeFile="GoogleLike.aspx.cs" Inherits="WebFormAdmin_GoogleLike" %>
<%@ Register Assembly="DayPilot" Namespace="DayPilot.Web.Ui" TagPrefix="DayPilot" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
<style type="text/css">
</style>

<style type="text/css">
.style1
{
height: 24px;
}
</style>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server">

<asp:UpdatePanel ID="updatepanel5" runat="server" UpdateMode="Always">
<contenttemplate>

<table style="width:100%">
<tr>
<td style="background-color: #33628a; " align="right" class="style1">
 

</td>
<td colspan="2" style="background-color: #33628a; margin-left: 120px;
color: white; font-size: 25px; " align="center"
class="style1" >
Calendar
</td>

<td style="background-color: #33628a; " align="right"
class="style1">
 
</td>
</tr>
<tr>
<td>
 
</td>
</tr>
<tr>
<td valign="top" style="width:150px">
<DayPilot:DayPilotNavigator ID="DayPilotNavigator1" runat="server"
BoundDayPilotID="DayPilotCalendar1"
SelectMode="Week"
ShowMonths="3"
CssClassPrefix="navigator_google_"
DataStartField="startdate"
DataEndField="enddate"
VisibleRangeChangedHandling="CallBack"
önVisibleRangeChanged="DayPilotNavigator1_VisibleRangeChanged"
>
<br />
<br />
<div style="height:20px"></div>
</td>
<td valign="top">

<daypilot:daypilotcalendar id="DayPilotCalendar1" runat="server"
DataStartField="startdate" DataEndField="enddate" datatextfield="Meeting Name" DataValueField="MeetingId"
datatagfields="Meeting Name, MeetingId"

Days="7"
EventCorners="Rounded"
MoveBy="Top"
CellSelectColor="#cccccc"
ShowAllDayEventStartEnd="false"
EventArrangement="Full"
EventHeaderVisible="true"
ShowEventStartEnd="true" style="top: 0px; left: 0px; height: auto; width: 100%"
önCommand="DayPilotCalendar1_Command"

ScrollLabelsVisible="false"
DurationBarVisible="false"
BackColor="white"
NonBusinessBackColor="white"
EventBackColor="#638EDE"
EventBorderColor="#2951A5"
HourNameBackColor="#F3F3F9"
CornerBackColor="#F3F3F9"
HourFontColor="#42658C"
HeaderFontColor="#42658C"
EventFontColor="white"
ShowToolTip="true"
EventFontFami
Sriram Ramachandran 10-Oct-13 6:37am    
i m getting only for current system date.... The meeting names are placing at corresponding dates like 12/12/2013 and its not navigating too .......... Can anyone help me pls ???
thatraja 10-Oct-13 8:27am    
Seriously your question is not clear. Explain the issue clearly with complete details. And include the screenshot for easy understanding.(To upload images, use imgur.com)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900