DayPilot Forums

DayPilot is the best open-source Outlook-like calendar control for ASP.NET.
DayPilot Pro Demo (Calendar control)
» DayPilot Pro live demo (Calendar control)
DayPilot Pro Demo (Scheduler control)
» DayPilot Pro live demo (Scheduler control)
Home » How To » code for databinding

code for databinding

Can anyone help me with the code for databinding. I tried myself but not working
Anonymous - 6/26/2008 1:26:58 PM

What do you want to do?

You got to add to the daypilotschedular the following attributes

DataValueField="YourID field" DataResourceField="your resource ID field"
DataStartField=""From field" DataEndField="date to field" dataTextfield="what shows in the event cell"

plus DataSourceID="your data source i

John - 6/26/2008 9:02:47 PM
Is there any place I can get the entire code to insert the data into a database?
Anonymous - 6/27/2008 5:09:47 PM
You should take a look at the DemoSQL directory, especially DemoSQL/Default.aspx.cs. You will find a sample TimeRangeSelected handler there:
    protected void DayPilotCalendar1_TimeRangeSelected(object sender, 
TimeRangeSelectedEventArgs e)
{

using (SqlConnection con
= new SqlConnection(ConfigurationManager.ConnectionStrings["daypilot"].ConnectionString))
{
con.Open();

SqlCommand cmd = new SqlCommand("INSERT INTO [event] (eventstart, eventend, name, allday) VALUES (@start, @end, @name, 0)", con);
cmd.Parameters.AddWithValue("start", e.Start);
cmd.Parameters.AddWithValue("end", e.End);
cmd.Parameters.AddWithValue("name", "New event");
cmd.ExecuteNonQuery();

}

DayPilotCalendar1.DataBind();
DayPilotCalendar1.Update();

}
This demonstrates how to do it for DayPilotCalendar, but DayPilotScheduler works the same way.
Dan Letecky - 6/27/2008 9:35:05 PM
Post reply