search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

how to add two row in calendar?

Asked by varsha
13 years ago.

I want to add two row on header of the calendar.

first row contain current date and second row contain no of coloum with dynamic resource coming from database.

Comment posted by jjsabe
13 years ago.

I recommend you to download the trial version of the calendar. It comes with many examples and one of them is how to add resrouces. it's quite simple.

string[] resources = new string[] {"A", "B", "C"};

for (int i = 0; i < 3; i++)
{

Column c = new Column(resources[i], resources[i]);
DayPilotCalendar1.Columns.Add(c);

for (int j = 0; j < 2; j++)
{
DateTime day = first.AddDays(j);

Column subC = new Column(day.ToShortDateString(), resources[i]);
subC.Date = day;
c.Children.Add(subC);
}
}

Comment posted by varsha
13 years ago.

thanks,

now its working fine but events are not binding in calendar.

my code is:

private void defineColumns()
{

DayPilotCalendar1.Columns.Clear();
DateTime day = DayPilotCalendar1.StartDate;
Column c = new Column(day.ToShortDateString(), day.ToString("s"));


DayPilotCalendar1.Update(CallBackUpdateType.Full);

c.Date = day;
DayPilotCalendar1.Columns.Add(c);


foreach (DataRow dr in dt.Rows)
{
Column c1 = new Column((string)dr["name"], dr["name"].ToString());
c1.Date = day;
c.Children.Add(c1);

}

}

when i click on navigater events are not bind in calendar.


Comment posted by Dan Letecky
13 years ago.

If the Navigator clicks don't update the Calendar, you need to check if you are handling Command event properly and doing the actual update for e.Command == "navigate".

Example:

protected void DayPilotCalendar1_Command(object sender, CommandEventArgs e)
{
  switch (e.Command)
  {
    case "navigate":
      DateTime start = (DateTime) e.Data["start"];
      DayPilotCalendar1.StartDate = start;
      DayPilotCalendar1.DataBind();
      DayPilotCalendar1.Update();
      break;
    // other custom commands handled here
  }
}

You also need to check whether the Value of the bottom-most Column (the deepest child) matches the Resource value of the Event (value of column defined using DataResourceField).

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.