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

code for databinding

Asked by Anonymous
16 years ago.
Can anyone help me with the code for databinding. I tried myself but not working
Comment posted by John
16 years ago.

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

Comment posted by Anonymous
16 years ago.
Is there any place I can get the entire code to insert the data into a database?
Comment posted by Dan Letecky
16 years ago.
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.
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.