Hi Chan,
You can create a new DataSet and merget the date and time fields. Here is an example:
protected
void
Page_Load(
object
sender, EventArgs e)
{
SqlDataAdapter custAdapter =
new
SqlDataAdapter(@
"SELECT * FROM [AppointmentTestTable]"
, @
"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Telerik.mdf;Integrated Security=True;User Instance=True"
);
DataSet DS =
new
DataSet();
custAdapter.Fill(DS,
"AppointmentsTestTable"
);
DataColumn start =
default
(DataColumn);
DataColumn end =
default
(DataColumn);
start =
new
DataColumn(
"Start"
, System.Type.GetType(
"System.DateTime"
));
end =
new
DataColumn(
"End"
, System.Type.GetType(
"System.DateTime"
));
DS.Tables[
"AppointmentsTestTable"
].Columns.Add(start);
DS.Tables[
"AppointmentsTestTable"
].Columns.Add(end);
foreach
(DataRow dr
in
DS.Tables[
"AppointmentsTestTable"
].Rows)
{
dr[
"Start"
] = ((DateTime)dr[
"StartDate"
]).Add((TimeSpan)dr[
"StartTime"
]);
dr[
"End"
] = ((DateTime)dr[
"StartDate"
]).Add((TimeSpan)dr[
"EndTime"
]);
}
RadScheduler1.DataSource = DS;
RadScheduler1.DataKeyField =
"ID"
;
RadScheduler1.DataSubjectField =
"Subject"
;
RadScheduler1.DataStartField =
"Start"
;
RadScheduler1.DataEndField =
"End"
;
RadScheduler1.DataBind();
}
Attached is a sample for reference.
You can also take a look at the online documentation linked below, concerning RadScheduler's binding to a data source:
RadScheduler Data binding.
Binding two columns of a data base table to a single data container is rather unnecessary. The documentation linked above, explains in details the structure of a data base to which a RadScheduler control could be bound.
The online
populating with data demos of the RadScheduler, might be of help, too.
All the best,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their
blog feed now