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

Help with this databinding with Scheduler

Asked by Anonymous
14 years ago.

Hi, I'm trying to use the scheduler to pull data from SQL and display. The problem is the grid comes up blank everytime...I don't understand why the data isn't binding or displaying or whatever...any help is GREATLY appreciated.

Here is the first part:

using System;
using System.Data;

public partial class SchedulerMonth : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
if (!IsPostBack)
DayPilotScheduler1.StartDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
DayPilotScheduler1.Days = DateTime.DaysInMonth(DateTime.Today.Year, DateTime.Today.Month);
Label1.Text = DayPilotScheduler1.StartDate.ToString("MMMM yyyy");
DayPilotScheduler1.DataSource = sql;

This is right from the demo minus the DayPilotScheduler1.DataSource = sql; which I've added as a datasource...simple select * from table Here is the data:

ID Name Start End resource
1 first event 2009-02-03 00:00:00.000 2009-02-03 00:00:00.000 Bob
2 second event 2009-02-03 00:00:00.000 2009-02-03 00:00:00.000 Joe

Here is the aspx page...didn't change from original much

<%@ Page Language="C#" MasterPageFile="~/Demo.master" AutoEventWireup="true" CodeFile="SchedulerMonth.aspx.cs" Inherits="SchedulerMonth" Title="DayPilot Lite Demo | Monthly Scheduler" %>
<%@ Register Assembly="DayPilot" Namespace="DayPilot.Web.Ui" TagPrefix="DayPilot" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:Label ID="Label1" runat="server" Text="Label" Font-Bold="true" Font-Size="16pt"></asp:Label><br />

<DayPilot:DayPilotScheduler ID="DayPilotScheduler1" runat="server"
HeaderFontSize="8pt" HeaderHeight="20"
<DayPilot:Resource Name="Room A" Value="A" />
<DayPilot:Resource Name="Room B" Value="B" />
<DayPilot:Resource Name="Room C" Value="C" />
<DayPilot:Resource Name="Room D" Value="D" />
<DayPilot:Resource Name="Room E" Value="E" />
<DayPilot:Resource Name="Room F" Value="F" />
<DayPilot:Resource Name="Room G" Value="G" />
<DayPilot:Resource Name="Room H" Value="H" />
<DayPilot:Resource Name="Room I" Value="I" />
<DayPilot:Resource Name="Room J" Value="J" />
<DayPilot:Resource Name="Room K" Value="K" />
<DayPilot:Resource Name="Room L" Value="L" />
<DayPilot:Resource Name="Room M" Value="M" />

<asp:SqlDataSource ID="sql" runat="server"
ConnectionString="<%$ ConnectionStrings:db_OCEANS15ConnectionString %>"
SelectCommand="SELECT * FROM [tbl_Proj_Cal2]"></asp:SqlDataSource>


Comment posted by Szymon
14 years ago.

Hi. The problem is with events in database. You see nothing because none of your events match criteria (lets call them criteria).

First thing is RESOUCE. In Resource declaration you have Rooms from A to M with values from A to M. Example:

<DayPilot:Resource Name="Room C" Value="C" /> - Name represents name shown in sheduler and Value is connector between resource and event. So in this example a letter "C" should be somewhere in column Resource. In your example you have resources called BOB and JOE. They don't show up because you don't have a declared resource.

Add this:

<DayPilot:Resource Name="BOB" Value="Bob" />

<DayPilot:Resource Name="JOE" Value="Joe" />

Second thing is time range.

Start time and end time are the same. You see nothing because event last 0 seconds..... try to chage end time do 12:00:00 leaving same date for example or add whole day. Even if you declared cellduration to 1440 (one day) i doesn't mean the event last in days. You can still create event lasting one hour or even one second. So if you want a whole day event you need in start enter 2009-02-03 00:00:00 and in end enter 2009-02-03 23:59:59. In this scenario you will have a problem with day counting - but this is topic for new post. Or you can just put 2009-02-04 00:00:00 - then you will have one day difference.

Sorry for english, but it's not by native language - it's managed :-)

Hope this helped you

Greetings Szymon

Comment posted by Anonymous
14 years ago.


Thanks for the reply. The dates were in fact the problem. Also, in the database for a 1 day event I used

dr["start"] = temp_dt.Start;
dr["end"] = temp_dt.End.AddDays(1);

I didn't understand that part.

Thanks again!

Comment posted by Dan Letecky
13 years ago.

Just FYI, zero-duration events are allowed since build 1617.

See also DayPilot Pro 5.1 SP2 release notes.

Comment posted by Vivek
11 years ago.

Can you give any descriptive way (Step by Step / Code) to bind a sql table to scheduler of daypilot?

Comment posted by ronak radadiya
8 years ago.

how to dynamically this resource values bind with database values
<DayPilot:Resource Name=" " Value=" " />

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