I have a problem, where if DataStartFiend and Dataendfield is null in db will throw an exception. Please advise thank you
aspx
<telerik:RadScheduler ID="RadScheduler1" runat="server"
HoursPanelTimeFormat="htt" ValidationGroup="RadScheduler1" Width="100%" Height="600px"
MinutesPerRow="5" Skin="Office2007" DayStartTime="08:00:00" DayEndTime="15:00:00" ColumnWidth="200px"
DataKeyField="ID" DataStartField="Start" DataEndField="End" DataSubjectField="Subject"
DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentID"
AllowDelete="false" AllowEdit="false" AllowInsert="false" FirstDayOfWeek="Monday" LastDayOfWeek="Sunday"
DayHeaderDateFormat="d MMMM yyyy" WeekHeaderDateFormat="d MMMM yyyy" TimelineView-HeaderDateFormat="d MMMM yyyy"
TimelineView-ColumnHeaderDateFormat="d MMMM yyyy" MonthHeaderDateFormat="MMMM yyyy" SelectedView="WeekView">
</telerik:RadScheduler>
aspx.cs
public List<TimetablePeriod> TimetableCollection
{
set
{
RadScheduler1.DataSource = value;
}
}
TimetablePeriod.cs
public TimetablePeriod(long studentId, string startDate, string endDate,
string weekDay, string startTime, string endTime, string teacherTitle, string roomCode)
{
this.studentId = studentId;
this.startDate = startDate;
this.endDate = endDate;
this.weekDay = weekDay;
this.startTime = startTime;
this.endTime = endTime;
this.roomCode = roomCode;
this.recurParentID = null;
}
public DateTime Start
{
get { return GetDate(startDate, startTime); }
}
public DateTime End
{
get { return GetDate(startDate, endTime); }
}
private DateTime GetDate(string date, string time)
{
int year, month, day, hour, minute, second;
string[] dateParts = date.Split(new char[] { '-' });
year = Convert.ToInt32(dateParts[0]);
month = Convert.ToInt32(dateParts[1]);
day = Convert.ToInt32(dateParts[2]);
string[] timeParts = time.Split(new char[] { ':' });
hour = Convert.ToInt32(timeParts[0]);
minute = Convert.ToInt32(timeParts[1]);
second = Convert.ToInt32(timeParts[2]);
DateTime dt = new DateTime(year, month, day, hour, minute, second);
dt = dt.AddDays(this.GetDayOffset());
return dt;
}
Protected Sub cbxKonfektion_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemEventArgs) Handles cbxKonfektion.ItemDataBound Dim dataItem As DataRowView = CType(e.Item.DataItem, DataRowView) e.Item.Attributes("Gewicht_UG") = dataItem("Gewicht_UG") e.Item.Attributes("Gewicht_OG") = dataItem("Gewicht_OG") e.Item.Attributes("KGR_UG") = dataItem("KGR_UG") e.Item.Attributes("KGR_OG") = dataItem("KGR_OG") End Subprioritylist.DataSource = ""; prioritylist.DataValueField = ARConstants.PriorityListName; prioritylist.DataTextField = ARConstants.PriorityListId; prioritylist.DataBind(); prioritylist.Items.Insert(0, new ListItem("", "0")); prioritylist.SelectedIndex = 0;public void LoadLookup(Page page, DropDownList ddlPriority, DropDownList ddlRM, DropDownList ddlBSE, DropDownList ddlDataType) { LoadPriorityList(page,ddlPriority); LoadRFMList(page, ddlRM); LoadBSEList(page, ddlBSE); LoadSystemList(page, ddlDataType); } private void LoadPriorityList(Page page,DropDownList prioritylist) { prioritylist.DataSource = ""; prioritylist.DataValueField = ARConstants.PriorityListName; prioritylist.DataTextField = ARConstants.PriorityListId; prioritylist.DataBind(); prioritylist.Items.Insert(0, new ListItem("", "0")); prioritylist.SelectedIndex = 0; } private void LoadRFMList(Page page, DropDownList rfmlist) { rfmlist.DataSource = ""; rfmlist.DataValueField = ARConstants.RFMId; rfmlist.DataTextField = ARConstants.RFMName; rfmlist.DataBind(); rfmlist.Items.Insert(0, new ListItem("", "0")); rfmlist.SelectedIndex = 0; }