This is a migrated thread and some comments may be shown as answers.

"RadScheduler More..." Link Yield Gregorian Calendar Error

5 Answers 126 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Kevon Hayes
Top achievements
Rank 1
Kevon Hayes asked on 17 Apr 2012, 03:14 PM
When clicking on the "more..." link on the RadScheduler I receive the following error:

The DateTime represented by the string is not supported in calendar System.Globalization.GregorianCalendar.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: The DateTime represented by the string is not supported in calendar System.Globalization.GregorianCalendar.


Exception information:
    Exception type: FormatException
    Exception message: The DateTime represented by the string is not supported in calendar System.Globalization.GregorianCalendar.
   at System.DateTimeParse.ParseExact(String s, String format, DateTimeFormatInfo dtfi, DateTimeStyles style)
   at System.DateTime.ParseExact(String s, String format, IFormatProvider provider, DateTimeStyles style)
   at Telerik.Web.UI.SchedulerPostBackEvent.ParseJavaScriptTime(String jsTime)
   at Telerik.Web.UI.SchedulerPostBackEvent.DeserializeFromJSON(String json, RadScheduler scheduler)
   at Telerik.Web.UI.RadScheduler.RaisePostBackEvent(String eventArgument)
   at Telerik.Web.UI.RadScheduler.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

I do not get a line number so I'm not sure where the conversion is being made.  Any help would be appreciated.

This is my Master Page:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MacroTesting.aspx.cs" Inherits="corCalendarSpecialEvents.MacroTesting" %>
 
<%@ Register src="usercontrols/corCalendarSpecialEvents.ascx" tagname="corCalendarSpecialEvents" tagprefix="uc1" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnableScriptGlobalization="true">
    </asp:ScriptManager>
     
    <div>
        <uc1:corCalendarSpecialEvents ID="corCalendarSpecialEvents1" runat="server" />      
    </div>
    </form>
</body>
</html>

Here is the ASCX:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="corCalendarSpecialEvents.ascx.cs" Inherits="corCalendarSpecialEvents.usercontrols.corCalendarSpecialEvents" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<script type="text/javascript" src="http://www.site.com/Scripts/corCalendarEvent.js"></script>
<script type="text/javascript">
    function DisplayEventDetails(sender, eventArgs) {
 
        var IE = navigator.userAgent;
        if (IE.match("MSIE")) {
            var apt = eventArgs.get_appointment();
            var IE = navigator.userAgent;
            var startDate = new Date();
            var endDate = new Date();
            startDate = apt.get_start();
            endDate = apt.get_end();
 
            startDate = dateFormat(startDate, "dddd, mmmm, dS, yyyy, hh:MM:ss TT");
            endDate = dateFormat(endDate, "dddd, mmmm, dS, yyyy, hh:MM:ss TT");
 
            alert("Event:  " + apt.get_subject() + "\n" + "Description:  " + apt.get_description() + "\n" + "Start:  " + startDate.toString() + " CST" + "\n" + "End:  " + endDate.toString() + " CST");
        }
 
        else {
            var oWnd = $find("<%=corEventWindow.ClientID %>");
            var apt = eventArgs.get_appointment();
 
            subject = apt.get_subject();
            description = apt.get_description();
            start = apt.get_start();
            end = apt.get_end();
 
            start = dateFormat(start, "dddd, mmmm, dS, yyyy, hh:MM:ss TT");
            end = dateFormat(end, "dddd, mmmm, dS, yyyy, hh:MM:ss TT");
 
            document.getElementById("corEventText").innerHTML = subject;
            document.getElementById("corEventDescription").innerHTML = description;
            document.getElementById("corEventStart").innerHTML = start.toString() + " CST";
            document.getElementById("corEventEnd").innerHTML = end.toString() + " CST";
 
            oWnd.show();
        }
    }
</script>
 
<telerik:RadScheduler ID="rsCorSECalendar" runat="server"
    DataDescriptionField="Description" DataEndField="End" DataKeyField="ID"
    DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentID" DataReminderField="Reminder"
    DataSourceID="corSPCalendar" DataStartField="Start" DataSubjectField="Subject"
    StartEditingInAdvancedForm="False" EnableDescriptionField="True" SelectedView="MonthView"
    Width="794px" ReadOnly="true" Height="575px" OnClientAppointmentClick="DisplayEventDetails"
    Skin="Telerik" AdvancedForm-Modal="true" Culture="en-US">
        <AppointmentTemplate>
            <div id="corSEApptTemplate" style="font-family:Calibri;font-size:10pt;">
                <span style="font-weight:bold">Event: </span><%# Eval("Subject") %>
                <br />
                <span style="font-weight:bold">Description: </span><%# Eval("Description") %>
                <br />
                <span style="font-weight:bold">Start Time: </span><%# Eval("Start") %>
                      
                <span style="font-weight:bold">End Time: </span><%# Eval("End") %>
            </div>
        </AppointmentTemplate>
</telerik:RadScheduler>
<asp:SqlDataSource ID="corSPCalendar" runat="server"
    ConflictDetection="CompareAllValues"
    ConnectionString="<%$ ConnectionStrings:corCalendarSpecialEvents %>"
    DeleteCommand="DELETE FROM [Appointments] WHERE [ID] = @original_ID AND [Subject] = @original_Subject AND (([Description] = @original_Description) OR ([Description] IS NULL AND @original_Description IS NULL)) AND [Start] = @original_Start AND [End] = @original_End AND (([RoomID] = @original_RoomID) OR ([RoomID] IS NULL AND @original_RoomID IS NULL)) AND (([UserID] = @original_UserID) OR ([UserID] IS NULL AND @original_UserID IS NULL)) AND (([RecurrenceRule] = @original_RecurrenceRule) OR ([RecurrenceRule] IS NULL AND @original_RecurrenceRule IS NULL)) AND (([RecurrenceParentID] = @original_RecurrenceParentID) OR ([RecurrenceParentID] IS NULL AND @original_RecurrenceParentID IS NULL)) AND (([Reminder] = @original_Reminder) OR ([Reminder] IS NULL AND @original_Reminder IS NULL)) AND (([Annotations] = @original_Annotations) OR ([Annotations] IS NULL AND @original_Annotations IS NULL))"
    InsertCommand="INSERT INTO [Appointments] ([Subject], [Description], [Start], [End], [RoomID], [UserID], [RecurrenceRule], [RecurrenceParentID], [Reminder], [Annotations]) VALUES (@Subject, @Description, @Start, @End, @RoomID, @UserID, @RecurrenceRule, @RecurrenceParentID, @Reminder, @Annotations)"
    OldValuesParameterFormatString="original_{0}"
    SelectCommand="SELECT * FROM [Appointments]"
    UpdateCommand="UPDATE [Appointments] SET [Subject] = @Subject, [Description] = @Description, [Start] = @Start, [End] = @End, [RoomID] = @RoomID, [UserID] = @UserID, [RecurrenceRule] = @RecurrenceRule, [RecurrenceParentID] = @RecurrenceParentID, [Reminder] = @Reminder, [Annotations] = @Annotations WHERE [ID] = @original_ID AND [Subject] = @original_Subject AND (([Description] = @original_Description) OR ([Description] IS NULL AND @original_Description IS NULL)) AND [Start] = @original_Start AND [End] = @original_End AND (([RoomID] = @original_RoomID) OR ([RoomID] IS NULL AND @original_RoomID IS NULL)) AND (([UserID] = @original_UserID) OR ([UserID] IS NULL AND @original_UserID IS NULL)) AND (([RecurrenceRule] = @original_RecurrenceRule) OR ([RecurrenceRule] IS NULL AND @original_RecurrenceRule IS NULL)) AND (([RecurrenceParentID] = @original_RecurrenceParentID) OR ([RecurrenceParentID] IS NULL AND @original_RecurrenceParentID IS NULL)) AND (([Reminder] = @original_Reminder) OR ([Reminder] IS NULL AND @original_Reminder IS NULL)) AND (([Annotations] = @original_Annotations) OR ([Annotations] IS NULL AND @original_Annotations IS NULL))">
    <DeleteParameters>
        <asp:Parameter Name="original_ID" Type="Int32" />
        <asp:Parameter Name="original_Subject" Type="String" />
        <asp:Parameter Name="original_Description" Type="String" />
        <asp:Parameter Name="original_Start" Type="DateTime" />
        <asp:Parameter Name="original_End" Type="DateTime" />
        <asp:Parameter Name="original_RoomID" Type="Int32" />
        <asp:Parameter Name="original_UserID" Type="Int32" />
        <asp:Parameter Name="original_RecurrenceRule" Type="String" />
        <asp:Parameter Name="original_RecurrenceParentID" Type="Int32" />
        <asp:Parameter Name="original_Reminder" Type="String" />
        <asp:Parameter Name="original_Annotations" Type="String" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter Name="Subject" Type="String" />
        <asp:Parameter Name="Description" Type="String" />
        <asp:Parameter Name="Start" Type="DateTime" />
        <asp:Parameter Name="End" Type="DateTime" />
        <asp:Parameter Name="RoomID" Type="Int32" />
        <asp:Parameter Name="UserID" Type="Int32" />
        <asp:Parameter Name="RecurrenceRule" Type="String" />
        <asp:Parameter Name="RecurrenceParentID" Type="Int32" />
        <asp:Parameter Name="Reminder" Type="String" />
        <asp:Parameter Name="Annotations" Type="String" />
    </InsertParameters>
    <UpdateParameters>
        <asp:Parameter Name="Subject" Type="String" />
        <asp:Parameter Name="Description" Type="String" />
        <asp:Parameter Name="Start" Type="DateTime" />
        <asp:Parameter Name="End" Type="DateTime" />
        <asp:Parameter Name="RoomID" Type="Int32" />
        <asp:Parameter Name="UserID" Type="Int32" />
        <asp:Parameter Name="RecurrenceRule" Type="String" />
        <asp:Parameter Name="RecurrenceParentID" Type="Int32" />
        <asp:Parameter Name="Reminder" Type="String" />
        <asp:Parameter Name="Annotations" Type="String" />
        <asp:Parameter Name="original_ID" Type="Int32" />
        <asp:Parameter Name="original_Subject" Type="String" />
        <asp:Parameter Name="original_Description" Type="String" />
        <asp:Parameter Name="original_Start" Type="DateTime" />
        <asp:Parameter Name="original_End" Type="DateTime" />
        <asp:Parameter Name="original_RoomID" Type="Int32" />
        <asp:Parameter Name="original_UserID" Type="Int32" />
        <asp:Parameter Name="original_RecurrenceRule" Type="String" />
        <asp:Parameter Name="original_RecurrenceParentID" Type="Int32" />
        <asp:Parameter Name="original_Reminder" Type="String" />
        <asp:Parameter Name="original_Annotations" Type="String" />
    </UpdateParameters>
</asp:SqlDataSource>
<telerik:RadWindowManager ID="rwmSECalendar" AutoSize="false" KeepInScreenBounds="true"
    runat="server">
    <Windows>
        <telerik:RadWindow ID="corEventWindow" runat="server" Title="Event Details" IconUrl="http://www.rockfordil.gov/media/view_calendar_tasks.png"
            VisibleOnPageLoad="false" Width="560px" Height="350px" Skin="Telerik" Modal="true">
            <ContentTemplate>
                <div id="corEvent" class="corEvent">
                    <p style="padding-left: 10px; padding-right:10px;">                   
                        <span style="font-family:Calibri,Trebuchet MS, Arial; font-size: 20pt; font-weight:bold;">Event:</span>   <span id="corEventText" style="font-family:Calibri,Trebuchet MS, Arial; font-size: 14pt;"></span>
                        <br />
                        <br />
                        <span style="font-family:Calibri,Trebuchet MS, Arial; font-size: 20pt; font-weight:bold;">Description:</span>   <span id="corEventDescription" style="font-family:Calibri,Trebuchet MS, Arial; font-size: 14pt;"></span>
                        <br />
                        <br />
                        <span style="font-family:Calibri,Trebuchet MS, Arial; font-size: 20pt; font-weight:bold;">Start:</span>   <span id="corEventStart" style="font-family:Calibri,Trebuchet MS, Arial; font-size: 14pt;"></span>
                        <br />
                        <br />
                        <span style="font-family:Calibri,Trebuchet MS, Arial; font-size: 20pt; font-weight:bold;">End:</span>   <span id="corEventEnd" style="font-family:Calibri,Trebuchet MS, Arial; font-size: 14pt;"></span>
                    </p>
                </div>
            </ContentTemplate>
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>
corCalendarEvent.js
var dateFormat = function () {
    var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
    timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
    timezoneClip = /[^-+\dA-Z]/g,
    pad = function (val, len) {
        val = String(val);
        len = len || 2;
        while (val.length < len) val = "0" + val;
        return val;
    };
 
    // Regexes and supporting functions are cached through closure
    return function (date, mask, utc) {
        var dF = dateFormat;
 
        // You can't provide utc if you skip other args (use the "UTC:" mask prefix)
        if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) {
            mask = date;
            date = undefined;
        }
 
        // Passing date through Date applies Date.parse, if necessary
        date = date ? new Date(date) : new Date;
        if (isNaN(date)) throw SyntaxError("invalid date");
 
        mask = String(dF.masks[mask] || mask || dF.masks["default"]);
 
        // Allow setting the utc argument via the mask
        if (mask.slice(0, 4) == "UTC:") {
            mask = mask.slice(4);
            utc = true;
        }
 
        var _ = utc ? "getUTC" : "get",
        d = date[_ + "Date"](),
        D = date[_ + "Day"](),
        m = date[_ + "Month"](),
        y = date[_ + "FullYear"](),
        H = date[_ + "Hours"](),
        M = date[_ + "Minutes"](),
        s = date[_ + "Seconds"](),
        L = date[_ + "Milliseconds"](),
        o = utc ? 0 : date.getTimezoneOffset(),
        flags = {
            d: d,
            dd: pad(d),
            ddd: dF.i18n.dayNames[D],
            dddd: dF.i18n.dayNames[D + 7],
            m: m + 1,
            mm: pad(m + 1),
            mmm: dF.i18n.monthNames[m],
            mmmm: dF.i18n.monthNames[m + 12],
            yy: String(y).slice(2),
            yyyy: y,
            h: H % 12 || 12,
            hh: pad(H % 12 || 12),
            H: H,
            HH: pad(H),
            M: M,
            MM: pad(M),
            s: s,
            ss: pad(s),
            l: pad(L, 3),
            L: pad(L > 99 ? Math.round(L / 10) : L),
            t: H < 12 ? "a" : "p",
            tt: H < 12 ? "am" : "pm",
            T: H < 12 ? "A" : "P",
            TT: H < 12 ? "AM" : "PM",
            Z: utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
            o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
            S: ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]
        };
 
        return mask.replace(token, function ($0) {
            return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
        });
    };
} ();
 
// Some common format strings
dateFormat.masks = {
    "default": "ddd mmm dd yyyy HH:MM:ss",
    shortDate: "m/d/yy",
    mediumDate: "mmm d, yyyy",
    longDate: "mmmm d, yyyy",
    fullDate: "dddd, mmmm d, yyyy",
    shortTime: "h:MM TT",
    mediumTime: "h:MM:ss TT",
    longTime: "h:MM:ss TT Z",
    isoDate: "yyyy-mm-dd",
    isoTime: "HH:MM:ss",
    isoDateTime: "yyyy-mm-dd'T'HH:MM:ss",
    isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
};
 
// Internationalization strings
dateFormat.i18n = {
    dayNames: [
    "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
    "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
  ],
    monthNames: [
    "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
    "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
  ]
};
 
// For convenience...
Date.prototype.format = function (mask, utc) {
    return dateFormat(this, mask, utc);
};

5 Answers, 1 is accepted

Sort by
0
Kevon Hayes
Top achievements
Rank 1
answered on 18 Apr 2012, 04:59 PM
All,

I resolved this error by getting rid of the Date formatting script I was using.  This was initially frustrating for me because it would seem the breakpoint I was setting in Firebug wasn't getting hit... however once I realized that I was setting my breakpoint in the wrong code block (duh) I was able to realized the error of my way. 

So instead of using the Date Formatting Script (shown above) I just used the built-in ASP.NET AJAX "date.format" function and A LA KAZAAM!  Yesterday was a duh duh day for me a developer!

8^D
0
NK
Top achievements
Rank 1
answered on 05 Feb 2013, 11:41 AM
Hi ALL,
I am getting error when i clicked on the week view date header links.
ERROR:

The DateTime represented by the string is not supported in calendar System.Globalization.GregorianCalendar.



i have not wrote any single code for handle this click.Telerik RADscheduler automatically handle this.I have one .aspx page and bind the radcsheduler  and put that .aspx page inside the iframe with SRC.


Please suggest me for the same

Thanks in Advance.

Waiting for the reply.
0
Boyan Dimitrov
Telerik team
answered on 08 Feb 2013, 12:40 PM
Hello,

Unfortunately we are not able to reproduce that issue. Could you please provide some more information or a sample markup code that could replicate that error on our side. This way we can inspect thoroughly and be more helpful.

Regards,
Boyan Dimitrov
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.
0
NK
Top achievements
Rank 1
answered on 15 Feb 2013, 06:08 AM
Hello ALL,
Below is my code,still i m facing same error.
please any help will be appreciated.
I need to resolve this in high priority.
Public Sub LoadCalendar()
        Try
            Dim oStatement As SQLStatement
            Dim oViewInfo As Aptify.Framework.Application.ViewInfo

            Dim da As New DataAction(UC)
            If Request.QueryString("ViewID") <> "" AndAlso Request.QueryString("ViewID") IsNot Nothing Then
                oViewInfo = ApplicationObject.View(CLng(Request.QueryString("ViewID").ToString()))
            End If

            Dim sSQL As String = String.Empty
            Dim sSqlResource As String = String.Empty
            Dim sSqlResourceAll As String = String.Empty
            If Request.QueryString("ViewID") <> "" AndAlso Request.QueryString("ViewID") IsNot Nothing Then
                sSQL = Me.ApplicationObject.GetEntityBaseDatabase("Calendar Views") & _
                           "..spGetCalendarViewByViewID @ViewID=" & CStr(Request.QueryString("ViewID"))
                dt = Me.DataAction.GetDataTable(sSQL, IAptifyDataAction.DSLCacheSetting.BypassCache)
                sBaseView = ApplicationObject.GetEntityBaseView(CStr(dt.Rows(0)("Entity")))
            End If


            If dt.Rows.Count > 0 Then
                With m_oCalendarViewInfo
                    .Load(dt.Rows(0))

                    oStatement = New SQLStatement(oViewInfo.ViewSQL, da)
                    dt = da.GetDataTable(oStatement.SQL)
                    ViewState("StartDateField") = m_oCalendarViewInfo.StartDateField
                    ViewState("EndDateField") = m_oCalendarViewInfo.EndDateField

                    sSqlResourceAll = "Select distinct(" + m_oCalendarViewInfo.GroupField + ")" + " from " + Me.ApplicationObject.GetEntityBaseDatabase("Calendar Views") & _
                           ".." & sBaseView
                    dtresourceAll = Me.DataAction.GetDataTable(sSqlResourceAll, IAptifyDataAction.DSLCacheSetting.BypassCache)


                    ''mode setting
                    Select Case .Mode
                        Case CalendarModeType.Day
                            EventCalenderScheduler.SelectedView = Telerik.Web.UI.SchedulerViewType.DayView

                        Case CalendarModeType.Week
                            EventCalenderScheduler.SelectedView = Telerik.Web.UI.SchedulerViewType.WeekView
                        Case CalendarModeType.Month
                            EventCalenderScheduler.SelectedView = Telerik.Web.UI.SchedulerViewType.MonthView
                        Case Else
                            EventCalenderScheduler.SelectedView = Telerik.Web.UI.SchedulerViewType.MonthView
                    End Select
                    'Selected Date Setting
                    If .FirstVisibleDateType = FirstVisibleDateType.Manual Then
                        EventCalenderScheduler.SelectedDate = .FirstVisibleDate
                    Else
                        Dim dr As DataRow() = dt.Select(" " & .StartDateField & " = Min(" & .StartDateField & ")")
                        If dr.Count > 0 Then
                            EventCalenderScheduler.SelectedDate = CDate(dr(0)(.StartDateField))
                        Else
                            EventCalenderScheduler.SelectedDate = Now.Date
                        End If
                    End If
                    'Startdate set as per navigation and selected View
                    If (Session("startdate") IsNot Nothing And CStr(Session("startdate")) <> "") Then
                        EventCalenderScheduler.SelectedDate = CDate(Session("startdate"))
                        If (radmeetingresource.Items.Count() > 0 AndAlso radmeetingresource2.Items.Count() > 0) Then
                            If (EventCalenderScheduler.SelectedView = Telerik.Web.UI.SchedulerViewType.WeekView) Then
                                sSqlResource = "Select  * from " + Me.ApplicationObject.GetEntityBaseDatabase("Calendar Views") & _
                                  ".." & sBaseView & " where " + m_oCalendarViewInfo.GroupField + " in('" + radmeetingresource.SelectedItem.Text + "', '" + radmeetingresource2.SelectedItem.Text + "') and " & .StartDateField & ">= " + " '" + CStr(Session("startdate")) + "' and " & .EndDateField & "<=  dateadd(day,7, '" + CStr(Session("startdate")) + "')"
                                dtresource = Me.DataAction.GetDataTable(sSqlResource, IAptifyDataAction.DSLCacheSetting.BypassCache)
                                If (dtresource.Rows.Count = 0) Then
                                    sSqlResource = "Select top 2  * from " + Me.ApplicationObject.GetEntityBaseDatabase("Calendar Views") & _
                                                                   ".." & sBaseView & "where " + m_oCalendarViewInfo.GroupField + " in('" + radmeetingresource.SelectedItem.Text + "', '" + radmeetingresource2.SelectedItem.Text + "') "
                                    dtresource = Me.DataAction.GetDataTable(sSqlResource, IAptifyDataAction.DSLCacheSetting.BypassCache)
                                End If
                            End If
                            If (EventCalenderScheduler.SelectedView = Telerik.Web.UI.SchedulerViewType.MonthView) Then
                                sSqlResource = "Select  * from " + Me.ApplicationObject.GetEntityBaseDatabase("Calendar Views") & _
                                 ".." & sBaseView & " where " + m_oCalendarViewInfo.GroupField + " in('" + radmeetingresource.SelectedItem.Text + "', '" + radmeetingresource2.SelectedItem.Text + "') and " & .StartDateField & ">= " + " '" + CStr(Session("startdate")) + "' and " & .EndDateField & "<=  dateadd(day,7, '" + CStr(Session("startdate")) + "')"
                                dtresource = Me.DataAction.GetDataTable(sSqlResource, IAptifyDataAction.DSLCacheSetting.BypassCache)
                                If (dtresource.Rows.Count = 0) Then
                                    sSqlResource = "Select top 2  * from " + Me.ApplicationObject.GetEntityBaseDatabase("Calendar Views") & _
                                                                   ".." & sBaseView & " where " + m_oCalendarViewInfo.GroupField + " in('" + radmeetingresource.SelectedItem.Text + "', '" + radmeetingresource2.SelectedItem.Text + "') "
                                    dtresource = Me.DataAction.GetDataTable(sSqlResource, IAptifyDataAction.DSLCacheSetting.BypassCache)
                                End If
                            End If
                            If (EventCalenderScheduler.SelectedView = Telerik.Web.UI.SchedulerViewType.DayView) Then
                                sSqlResource = "Select  * from " + Me.ApplicationObject.GetEntityBaseDatabase("Calendar Views") & _
                                   ".." & sBaseView & " where " + m_oCalendarViewInfo.GroupField + " in('" + radmeetingresource.SelectedItem.Text + "', '" + radmeetingresource2.SelectedItem.Text + "') and " & .StartDateField & ">= " + " '" + CStr(Session("startdate")) + "' and " & .EndDateField & "<=  dateadd(day,7, '" + CStr(Session("startdate")) + "')"
                                dtresource = Me.DataAction.GetDataTable(sSqlResource, IAptifyDataAction.DSLCacheSetting.BypassCache)
                                If (dtresource.Rows.Count = 0) Then
                                    sSqlResource = "Select top 2  * from " + Me.ApplicationObject.GetEntityBaseDatabase("Calendar Views") & _
                                                                    ".." & sBaseView & " where " + m_oCalendarViewInfo.GroupField + " in('" + radmeetingresource.SelectedItem.Text + "', '" + radmeetingresource2.SelectedItem.Text + "') "
                                    dtresource = Me.DataAction.GetDataTable(sSqlResource, IAptifyDataAction.DSLCacheSetting.BypassCache)
                                End If
                            End If
                        Else
                            sSqlResource = "Select top 2 * from " + Me.ApplicationObject.GetEntityBaseDatabase("Calendar Views") & _
                                  ".." & sBaseView
                            dtresource = Me.DataAction.GetDataTable(sSqlResource, IAptifyDataAction.DSLCacheSetting.BypassCache)
                        End If

                    Else
                        If (radmeetingresource.Items.Count() > 0 AndAlso radmeetingresource2.Items.Count() > 0) Then
                            If (EventCalenderScheduler.SelectedView = Telerik.Web.UI.SchedulerViewType.WeekView) Then
                                sSqlResource = "Select  * from " + Me.ApplicationObject.GetEntityBaseDatabase("Calendar Views") & _
                                   ".." & sBaseView & " where " + m_oCalendarViewInfo.GroupField + " in('" + radmeetingresource.SelectedItem.Text + "', '" + radmeetingresource2.SelectedItem.Text + "') and " & .StartDateField & ">= " + " '" + CStr(EventCalenderScheduler.SelectedDate) + "' and " & .EndDateField & "<=  dateadd(day,7, '" + CStr(EventCalenderScheduler.SelectedDate) + "')"
                                dtresource = Me.DataAction.GetDataTable(sSqlResource, IAptifyDataAction.DSLCacheSetting.BypassCache)
                                If (dtresource.Rows.Count = 0) Then
                                    sSqlResource = "Select top 2  * from " + Me.ApplicationObject.GetEntityBaseDatabase("Calendar Views") & _
                                                                   ".." & sBaseView & " where " + m_oCalendarViewInfo.GroupField + " in('" + radmeetingresource.SelectedItem.Text + "', '" + radmeetingresource2.SelectedItem.Text + "') "
                                    dtresource = Me.DataAction.GetDataTable(sSqlResource, IAptifyDataAction.DSLCacheSetting.BypassCache)
                                End If
                            End If
                            If (EventCalenderScheduler.SelectedView = Telerik.Web.UI.SchedulerViewType.MonthView) Then
                                sSqlResource = "Select  * from " + Me.ApplicationObject.GetEntityBaseDatabase("Calendar Views") & _
                                 ".." & sBaseView & " where " + m_oCalendarViewInfo.GroupField + " in('" + radmeetingresource.SelectedItem.Text + "', '" + radmeetingresource2.SelectedItem.Text + "') and " & .StartDateField & ">= " + " '" + CStr(EventCalenderScheduler.SelectedDate) + "' and " & .EndDateField & "<=  dateadd(day,7, '" + CStr(EventCalenderScheduler.SelectedDate) + "')"
                                dtresource = Me.DataAction.GetDataTable(sSqlResource, IAptifyDataAction.DSLCacheSetting.BypassCache)
                                If (dtresource.Rows.Count = 0) Then
                                    sSqlResource = "Select top 2  * from " + Me.ApplicationObject.GetEntityBaseDatabase("Calendar Views") & _
                                                                   ".." & sBaseView & " where " + m_oCalendarViewInfo.GroupField + " in('" + radmeetingresource.SelectedItem.Text + "', '" + radmeetingresource2.SelectedItem.Text + "') "
                                    dtresource = Me.DataAction.GetDataTable(sSqlResource, IAptifyDataAction.DSLCacheSetting.BypassCache)
                                End If
                            End If
                            If (EventCalenderScheduler.SelectedView = Telerik.Web.UI.SchedulerViewType.DayView) Then
                                sSqlResource = "Select  * from " + Me.ApplicationObject.GetEntityBaseDatabase("Calendar Views") & _
                                 ".." & sBaseView & " where " + m_oCalendarViewInfo.GroupField + " in('" + radmeetingresource.SelectedItem.Text + "', '" + radmeetingresource2.SelectedItem.Text + "') and " & .StartDateField & ">= " + " '" + CStr(EventCalenderScheduler.SelectedDate) + "' and " & .EndDateField & "<=  dateadd(day,7, '" + CStr(EventCalenderScheduler.SelectedDate) + "')"
                                dtresource = Me.DataAction.GetDataTable(sSqlResource, IAptifyDataAction.DSLCacheSetting.BypassCache)
                                If (dtresource.Rows.Count = 0) Then
                                    sSqlResource = "Select top 2  * from " + Me.ApplicationObject.GetEntityBaseDatabase("Calendar Views") & _
                                                                  ".." & sBaseView & " where " + m_oCalendarViewInfo.GroupField + " in('" + radmeetingresource.SelectedItem.Text + "', '" + radmeetingresource2.SelectedItem.Text + "') "
                                    dtresource = Me.DataAction.GetDataTable(sSqlResource, IAptifyDataAction.DSLCacheSetting.BypassCache)
                                End If
                            End If
                        Else
                            sSqlResource = "Select top 2 * from " + Me.ApplicationObject.GetEntityBaseDatabase("Calendar Views") & _
                                 ".." & sBaseView
                            dtresource = Me.DataAction.GetDataTable(sSqlResource, IAptifyDataAction.DSLCacheSetting.BypassCache)
                        End If

                    End If

                    If (radmeetingresource.Items.Count() > 0 AndAlso radmeetingresource2.Items.Count() > 0 AndAlso dtresource.Rows.Count = 2) Then
                        dtresource = GetArrangedReturnedResource(dtresource, m_oCalendarViewInfo.GroupField, radmeetingresource.SelectedItem.Text, radmeetingresource2.SelectedItem.Text)
                    End If


                    'EventCalenderScheduler.ToolTip = Convert.ToDateTime(.StartDateField).ToShortTimeString() + .TitleField
                    EventCalenderScheduler.DataSubjectField = .TitleField
                    EventCalenderScheduler.DataKeyField = "ID"
                    EventCalenderScheduler.DataDescriptionField = "ID"
                    EventCalenderScheduler.DataStartField = .StartDateField
                    If dt.Rows.Count > 0 Then
                        'Validation if Event Startdate is greater than Enddate(Need to resolve in smartclient)
                        For Each rw As DataRow In dt.Rows
                            If Convert.ToDateTime(rw(.StartDateField)) > Convert.ToDateTime(rw(.EndDateField)) Then
                                rw(.EndDateField) = rw(.StartDateField)
                            End If
                            'Validation if Event Startdate is equal to Enddate and time is not mentioned.
                            If Convert.ToDateTime(rw(.StartDateField)) = Convert.ToDateTime(rw(.EndDateField)) Then
                                rw(.EndDateField) = Convert.ToDateTime(rw(.EndDateField)).ToShortDateString() + "  11:59:00 PM"
                            End If
                            If Convert.ToDateTime(rw(.StartDateField)) < Convert.ToDateTime(rw(.EndDateField)) Then
                                If Convert.ToDateTime(rw(.StartDateField)).ToString("HH:mm") = Convert.ToDateTime(rw(.EndDateField)).ToString("HH:mm") Then
                                    rw(.EndDateField) = Convert.ToDateTime(rw(.EndDateField)).ToShortDateString() + "  11:59:00 PM"
                                End If
                            End If

                            If Convert.ToDateTime(rw(.StartDateField)).ToShortTimeString() = "12:00 AM" And Convert.ToDateTime(rw(.EndDateField)).ToShortTimeString() = "12:00 AM" Then
                                rw(.StartDateField) = Convert.ToDateTime(rw(.StartDateField)).ToShortDateString() + "  12:00:00 AM"
                                rw(.EndDateField) = Convert.ToDateTime(rw(.EndDateField)).ToShortDateString() + "  11:59:00 PM"
                            End If

                        Next
                    End If
                    ''Duration Mode Setting
                    Select Case .DurationMode
                        Case DurationMode.EndDate
                            EventCalenderScheduler.DataEndField = .EndDateField
                        Case DurationMode.StandardDuration
                            Dim dcolUrl As DataColumn = New DataColumn()
                            dcolUrl.Caption = "EndDateDuration"
                            dcolUrl.ColumnName = "EndDateDuration"
                            dt.Columns.Add(dcolUrl)
                            If dt.Rows.Count > 0 Then
                                For Each rw As DataRow In dt.Rows
                                    rw("EndDateDuration") = Convert.ToDateTime(rw(.StartDateField.ToString())).AddHours(.StandardDuration)
                                Next
                            End If
                            EventCalenderScheduler.DataEndField = "EndDateDuration"
                            'Dim dttime As DateTime = Convert.ToDateTime(.StartDateField).AddHours(.StandardDuration)

                        Case DurationMode.Duration
                            Dim dcolduration As DataColumn = New DataColumn()
                            dcolduration.Caption = "EndDateDurationHours"
                            dcolduration.ColumnName = "EndDateDurationHours"
                            dt.Columns.Add(dcolduration)
                            If dt.Rows.Count > 0 Then
                                For Each rw As DataRow In dt.Rows
                                    rw("EndDateDurationHours") = Convert.ToDateTime(rw(.EndDateField.ToString())).AddHours(Convert.ToDouble(rw(.DurationField)))
                                Next
                            End If
                            EventCalenderScheduler.DataEndField = "EndDateDurationHours"
                        Case Else
                            EventCalenderScheduler.DataEndField = .EndDateField
                    End Select
                    Select Case .GroupingStyle
                        Case GroupingStyle.GroupInsideDate
                            If (dtresource.Rows.Count > 0) Then
                                EventCalenderScheduler.GroupBy = .GroupField
                                UpdateResourceScheduler()
                                radmeetingresource.Visible = True
                                radmeetingresource2.Visible = True
                            End If
                        Case GroupingStyle.DateInsideGroup
                            If (dtresource.Rows.Count > 0) Then
                                EventCalenderScheduler.GroupBy = .GroupField
                                UpdateResourceScheduler()
                                radmeetingresource.Visible = True
                                radmeetingresource2.Visible = True
                            End If
                        Case GroupingStyle.None
                            'EventCalenderScheduler.GroupBy = .GroupField
                            radmeetingresource.Visible = False
                            radmeetingresource2.Visible = False
                    End Select
                    EventCalenderScheduler.DataReminderField = .TitleField
                    EventCalenderScheduler.DataSource = dt
                    EventCalenderScheduler.DataBind()

                End With
            Else
                Response.Write("There is an error in loading the selected view. Please contact administrator.")
            End If
        Catch ex As Exception
            Response.Write("There is an error in loading the selected view. Please contact administrator.")
        End Try
    End Sub
Thanks In ADVANCE
0
Boyan Dimitrov
Telerik team
answered on 19 Feb 2013, 03:42 PM
Hello,

It seems that the provided exception is caused either by an invalid data retrieved from your database or by your custom functionality. I am afraid that due lots of custom data in the provided code we are unable to run and inspect it.

Regards,
Boyan Dimitrov
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.
Tags
Scheduler
Asked by
Kevon Hayes
Top achievements
Rank 1
Answers by
Kevon Hayes
Top achievements
Rank 1
NK
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Share this question
or