Проблема с Telerik Scheduler с использованием Chrome

Я реализовал код в среде asp.net C# для перетаскивания из дерева Telerik в планировщик Telerik для создания встречи.

Иногда проблема возникала только в Chrome, когда я планировал назначать встречи, просто перетаскивая их в планировщик Telerik из дерева Telerik.

Описание ошибки приведено ниже:

"1176.666697837689 не является допустимым значением для Int32." Каждый раз десятичное значение меняется.

Ошибка ExceptionStackTrace, как показано ниже:

at System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
at System.ComponentModel.TypeConverter.ConvertFromInvariantString(String text)
at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeInternal(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object& convertedObject)
at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeMain(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object& convertedObject)
at System.Web.Script.Serialization.ObjectConverter.AssignToPropertyOrField(Object propertyValue, Object o, String memberName, JavaScriptSerializer serializer, Boolean throwOnError)
at System.Web.Script.Serialization.ObjectConverter.ConvertDictionaryToObject(IDictionary`2 dictionary, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object& convertedObject)
at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeInternal(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object& convertedObject)
at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeMain(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object& convertedObject)
at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)
at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input)
at Telerik.Web.UI.RadScheduler.LoadPostData(String postDataKey, NameValueCollection postCollection)
at Telerik.Web.UI.RadDataBoundControl.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection)
at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Я использовал приведенный ниже код для перетаскивания из Telerik TreeView в Telerik Scheduler:

<telerik:RadScriptBlock ID="RadScriptBlock1"  runat="server">
        <script type="text/javascript">
            //<![CDATA[
            //Shows whether an Appointment is inserted directry, or the
            //the Advanced Insert Form is opened when TreeView node is dropped on the Scheduler.
            var directlyInsertAppointment = true;
            var selectedAppointment = null;

            function nodeDropping(sender, eventArgs) {
                var htmlElement = eventArgs.get_htmlElement();
                var scheduler = $find('<%= RadScheduler1.ClientID %>');
                if (isPartOfSchedulerAppointmentArea(htmlElement)) {
                    //Gets the TimeSlot where an Appointment is dropped.
                    var timeSlot = scheduler.get_activeModel().getTimeSlotFromDomElement(htmlElement);
                    var startTime = timeSlot.get_startTime();
                    var startTimes = startTime.toDateString() + " " + startTime.toTimeString();

                    document.getElementById('<%= hdnScheduledStartDateTime.ClientID %>').value = startTimes;

                    //Gets all the data needed for the an Appointment, from the TreeView node.
                    var node = eventArgs.get_sourceNode();
                    var text = node.get_text();
                    document.getElementById('<%= hdnSessionSubject.ClientID%>').value = text;
                    var nodeVal = node.get_value();
                    document.getElementById('<%= hdnPTSessionsClientManagementId.ClientID %>').value = nodeVal;

                    var attributes = node.get_attributes();
                    var PTSessionMgmtID = attributes.getAttribute("PTSessionsManagementId");
                    document.getElementById('<%= hdnPTSessionsManagementId.ClientID %>').value = PTSessionMgmtID;
                    var SessionTypeId = attributes.getAttribute("SessionTypeId");
                    document.getElementById('<%= hdnSessionTypeId.ClientID %>').value = SessionTypeId;
                    var duration = attributes.getAttribute("Duration");
                    var endTime = new Date(startTime);
                    endTime.setMinutes(parseInt(endTime.getMinutes()) + parseInt(duration));
                    var endTimes = endTime.toDateString() + " " + endTime.toTimeString();
                    document.getElementById('<%= hdnScheduledEndDateTime.ClientID %>').value = endTimes;
                    var parentValue = node.get_parent().get_value();
                    var category = scheduler.get_resources().getResourceByTypeAndKey("Category", parentValue);

                    //New appointment is created. The start/end time, subject and category are set.
                    var newAppointment = new Telerik.Web.UI.SchedulerAppointment();
                    newAppointment.set_start(startTime);
                    newAppointment.set_end(endTime);
                    newAppointment.set_subject(text);
                    if (category != null) {
                        newAppointment.get_resources().add(category);
                    }
                    //Checks for the user's choice of the method for inserting Appointments.
                    if (directlyInsertAppointment) {
                        scheduler.insertAppointment(newAppointment);
                    } else {
                        //If Advanced Form is opened, the information from the TreeVew node is stored in a hidden input.
                        var appointmentInfo = { subject: text, duration: duration, category: category };
                        var appointmentInfoSerialized = Sys.Serialization.JavaScriptSerializer.serialize(appointmentInfo);
                        $get("<%=HiddenInputAppointmentInfo.ClientID%>").value = appointmentInfoSerialized;
                        scheduler.showInsertFormAt(timeSlot);
                    }
                }
                else {
                    //The node was dropped elsewhere on the document.
                    eventArgs.set_cancel(true);
                }
            }
        </script>

Эта функция работает правильно на локальном сервере, но почему-то не работает на клиентском сервере, иногда в браузере Chrome.

1 ответ

По-видимому, это исправлено в новых версиях Telerik, но вызвано тем, что Google Chrome теперь отправляет дробные значения пикселей для позиций прокрутки:

Некоторые обходные пути перечислены здесь: https://www.telerik.com/forums/system-formatexception-78e82e51af27

Другие вопросы по тегам