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

Context menu javascript error

22 Answers 174 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Alan
Top achievements
Rank 1
Alan asked on 21 Jan 2011, 09:16 AM
I'm trying to implement an appointment context menu, unfortunately it's giving me an exception here:

Javascript -
l.findItemByValue("CommandEdit").set_enabled(true);
l.findItemByValue("CommandDelete").set_enabled(true);

The scheduler's code is as follows:
<telerik:RadScheduler ID="radScheduler" runat="server" DayEndTime="19:00:00" FirstDayOfWeek="Monday"
    LastDayOfWeek="Sunday" OverflowBehavior="Expand" SelectedView="WeekView" ShowAllDayRow="True"
    ShowFooter="False" Skin="Windows7" WorkDayEndTime="19:00:00" OnClientAppointmentClick="OnClientAppointmentClick"
    OnClientTimeSlotClick="OnClientTimeSlotClick" ShowViewTabs="False" CustomAttributeNames="FileCode, DocketNo"
    AdvancedForm-EnableCustomAttributeEditing="true" AllowInsert="False" OnTimeSlotCreated="radScheduler_TimeSlotCreated"
    OnFormCreated="radScheduler_FormCreated" StartInsertingInAdvancedForm="false"
    EnableDescriptionField="true" EnableCustomAttributeEditing="true" Localization-AdvancedSubject="Code Center"
    OnAppointmentContextMenuItemClicked="radScheduler_AppointmentContextMenuItemClicked">
    <AdvancedForm Modal="True" />
    <Localization AdvancedSubject="Code Center"></Localization>
    <TimelineView UserSelectable="False" />
    <MonthView UserSelectable="False" />
    <AppointmentContextMenus>
        <telerik:RadSchedulerContextMenu ID="contextMenu" runat="server">
            <Items>
                <telerik:RadMenuItem runat="server" Text="Negate Timesheet" Value="NegateCommand">
                </telerik:RadMenuItem>
            </Items>
        </telerik:RadSchedulerContextMenu>
    </AppointmentContextMenus>
</telerik:RadScheduler>


The I even tried generating the context menu from telerik's plugin GUI.

Thanks in advance for your help.

Daryl

22 Answers, 1 is accepted

Sort by
0
Accepted
Veronica
Telerik team
answered on 21 Jan 2011, 09:26 AM
Hi Daryl,

This is a known issue for RadScheduler. Take a look at this sticky forum post.

Please accept my apologies for the caused inconvenience.

Regards,
Veronica Milcheva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Alan
Top achievements
Rank 1
answered on 21 Jan 2011, 09:28 AM
Thank you Veronica

Sorry for the post! I should have read that first.
0
Alan
Top achievements
Rank 1
answered on 21 Jan 2011, 09:37 AM
Hi Veronica,

I cannot find any internal builds. It says:

No internal builds for RadControls for ASP.NET AJAX 2010.3 1317 have been uploaded recently.

Many Thanks,
Daryl
0
Alan
Top achievements
Rank 1
answered on 24 Jan 2011, 08:19 AM
Hi Veronica,

How can I get the latest internal build?

Thanks,
Daryl
0
Veronica
Telerik team
answered on 26 Jan 2011, 10:53 AM
Hi Daryl,

Internal build 2010. 3 1317 is already uploaded. You can get it from this url.

All the best,
Veronica Milcheva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Alan
Top achievements
Rank 1
answered on 26 Jan 2011, 04:31 PM
Ok so I updated tot he latest internal build, and the context menu now shows up on Appointments, which is how I want it to be.

Unfortunately two things are happening:

1) I only created an appointment context menu, yet it's giving me errors when I don't right-click on appointments, see attached image of when I right clicked on an empty timeslot. The same error happens pretty much everywhere I right click (on the scheduler).

Scheduler's code:
<telerik:radscheduler id="radScheduler" runat="server" dayendtime="19:00:00" firstdayofweek="Monday"
    lastdayofweek="Sunday" overflowbehavior="Expand" selectedview="WeekView" showalldayrow="True"
    showfooter="False" skin="Windows7" workdayendtime="19:00:00" onclientappointmentclick="OnClientAppointmentClick"
    onclienttimeslotclick="OnClientTimeSlotClick" showviewtabs="False" customattributenames="FileCode, DocketNo"
    advancedform-enablecustomattributeediting="true" allowinsert="False" ontimeslotcreated="radScheduler_TimeSlotCreated"
    onformcreated="radScheduler_FormCreated" startinsertinginadvancedform="false"
    enabledescriptionfield="true" enablecustomattributeediting="true" localization-advancedsubject="Code Center"
    onappointmentcontextmenuitemclicked="radScheduler_AppointmentContextMenuItemClicked"
    enableexacttimerendering="true" onnavigationcomplete="radScheduler_NavigationComplete">
    <AdvancedForm Modal="True" />
    <Localization AdvancedSubject="Code Center"></Localization>
    <TimelineView UserSelectable="False" />
    <MonthView UserSelectable="False" />
    <AppointmentContextMenuSettings Skin="Windows7" />
    <AppointmentContextMenus>
        <telerik:RadSchedulerContextMenu ID="contextMenu" runat="server">
            <Items>
                <telerik:RadMenuItem runat="server" Text="Negate Timesheet" Value="NegateCommand">
                </telerik:RadMenuItem>
            </Items>
        </telerik:RadSchedulerContextMenu>
    </AppointmentContextMenus>
</telerik:radscheduler>


2) I have some code which displays timings in the allday row, specifically this one. My Code is:

protected void radScheduler_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
{
    // Calculate total hours per day.
    if (radScheduler.SelectedView == SchedulerViewType.WeekView && e.TimeSlot.Duration.TotalDays == 1)
    {
        double totalHoursPerDay         = 0;
        double totalOvertimeHoursPerDay = 0;
        bool weekend = false;
 
        if (e.TimeSlot.Start.DayOfWeek == DayOfWeek.Saturday || e.TimeSlot.Start.DayOfWeek == DayOfWeek.Sunday)
        {
            weekend = true;
        }
 
        foreach (Appointment a in radScheduler.Appointments.GetAppointmentsInRange(e.TimeSlot.Start, e.TimeSlot.End))
        {
            // Check time of appointment and adding to hours or overtime accordingly.
            if (a.Start.TimeOfDay >= new TimeSpan(8, 0, 0) && a.End.TimeOfDay <= new TimeSpan(19, 0, 0) && weekend)
            {
                totalOvertimeHoursPerDay += a.Duration.TotalHours;
            }
            else if (a.Start.TimeOfDay >= new TimeSpan(8, 0, 0) && a.End.TimeOfDay <= new TimeSpan(17, 0, 0))
            {
                totalHoursPerDay += a.Duration.TotalHours;
            }
            else if (a.Start.TimeOfDay > new TimeSpan(17, 0, 0) && a.End.TimeOfDay <= new TimeSpan(19, 0, 0))
            {
                totalOvertimeHoursPerDay += a.Duration.TotalHours;
            }
            else if (a.Start.TimeOfDay >= new TimeSpan(8, 0, 0) && a.End.TimeOfDay <= new TimeSpan(19, 0, 0))
            {
                double overtime = a.End.TimeOfDay.TotalHours - 17;
                totalOvertimeHoursPerDay += overtime;
                totalHoursPerDay += (a.Duration.TotalHours - overtime);
            }
        }
 
        Literal hoursLiteral       = new Literal();
        Literal overtimeLiteral    = new Literal();
 
        if (!weekend)
        {
            hoursLiteral.Text = "Hrs: " + totalHoursPerDay.ToString();
        }
 
        overtimeLiteral.Text = " O/T: " + totalOvertimeHoursPerDay.ToString();
 
        radScheduler.Controls.Add(hoursLiteral);
        radScheduler.Controls.Add(overtimeLiteral);
 
        e.TimeSlot.Control.Controls.Add(hoursLiteral);
        e.TimeSlot.Control.Controls.Add(overtimeLiteral);
    }
}

With the context menu enabled, this is causing an exception when I switch week (in weekview). The exception is: "Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.", and it happens on:

radScheduler.Controls.Add(hoursLiteral);

Thank you for your support.

Daryl
0
Alan
Top achievements
Rank 1
answered on 27 Jan 2011, 10:20 AM
Problem (1) happens with or without context menu.
0
Veronica
Telerik team
answered on 27 Jan 2011, 12:24 PM
Hello Daryl,

Unfortunately I gave you link to the same official release instead of the latest internal build.
Please accept my apologies for misleading you.

Here's the link to the latest internal build.

Please test it and let me know how it goes.

Greetings,
Veronica Milcheva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Alan
Top achievements
Rank 1
answered on 27 Jan 2011, 03:43 PM
Actually I noticed that the link was wrong and downloaded "Telerik.Web.UI_2010_3_1325_Dev_hotfix.zip". The version I'm using is 2010.3.1325.40.
0
Ashley
Top achievements
Rank 1
answered on 27 Jan 2011, 04:39 PM
Although this is not an issue in the Trial version of the AJAX controls, it appears to be an issue in the latest Full version of the controls (2010.3.1317.35). It appears to be in the script which it is downloading from your site:

http://aspnet-scripts.telerikstatic.com/ajaxz/2010.3.1317/Scheduler/RadSchedulerScripts.js

In this script, it isn't checking the null status of CommandEdit or CommandDelete.
0
Peter
Telerik team
answered on 27 Jan 2011, 06:31 PM
Hi Ashley,

This is actually expected. Please, refer to the RadScriptManager Overview help topic. In particular, this part:

When NOT to use CDN?

  • Intranet applications in particular are a bad candidate for it. Your Intranet is likely to be a lot faster than any type of CDN. You’ll also lose the ability to run your application without an Internet connection.
  • When you are using a latest internal build (not an official one). CDN support will be enabled only for:
    • Official Major Releases
    • Official Service Packs
    • BETA releases 



All the best,
Peter
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Alan
Top achievements
Rank 1
answered on 28 Jan 2011, 08:49 AM
Might I also add that even though the application works and compiles, visual studio designer doesn't. 

See attached photo.
0
Peter
Telerik team
answered on 28 Jan 2011, 09:59 AM
Hello Daryl,

Please, check the Design-time Troubleshooting help topic.


Regards,
Peter
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Alan
Top achievements
Rank 1
answered on 28 Jan 2011, 10:10 AM
Hi Peter,

Does that apply for visual studio 2010?

Thanks,
Daryl
0
Peter
Telerik team
answered on 28 Jan 2011, 10:37 AM

There are sections in the help topic that are specific to VS 2008, but in general and for the most part the content applies to VS 2010 as well.


Peter
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Alan
Top achievements
Rank 1
answered on 28 Jan 2011, 03:28 PM
Thanks Peter, that fixed my designer problems, unfortunately I still have these.
0
Peter
Telerik team
answered on 31 Jan 2011, 03:58 PM
Hi Daryl,

Have you disabled the CDN feature? Also, can you tell us the exact version that you currently use?


Best wishes,
Peter
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Alan
Top achievements
Rank 1
answered on 31 Jan 2011, 04:18 PM
CDN was set to auto, I tried turning it off but still it's giving me errors.

I'm using version 2010.3.1325.40.
0
Peter
Telerik team
answered on 31 Jan 2011, 04:54 PM
Hello Daryl,

That's strange indeed. Can you open a support ticket and send us a simple working demo of the issue?

Best wishes,
Peter
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Alan
Top achievements
Rank 1
answered on 01 Feb 2011, 10:03 AM
Will do, thanks Peter!
0
Alan
Top achievements
Rank 1
answered on 03 Feb 2011, 09:26 AM
Could you help with problem 2, or should I create a separate thread? (Viewstate issue)
0
Peter
Telerik team
answered on 03 Feb 2011, 07:21 PM
Hi Daryl,

Yes, please open a new support thread and attach any relevant files there.

Thank you for your understanding.


Regards,
Peter
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Scheduler
Asked by
Alan
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Alan
Top achievements
Rank 1
Ashley
Top achievements
Rank 1
Peter
Telerik team
Share this question
or