Context menu javascript error

23 posts, 1 answers
  1. Alan
    Alan avatar
    107 posts
    Member since:
    Oct 2010

    Posted 21 Jan 2011 Link to this post

    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
  2. Answer
    Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 21 Jan 2011 Link to this post

    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.
  3. Alan
    Alan avatar
    107 posts
    Member since:
    Oct 2010

    Posted 21 Jan 2011 Link to this post

    Thank you Veronica

    Sorry for the post! I should have read that first.
  4. Alan
    Alan avatar
    107 posts
    Member since:
    Oct 2010

    Posted 21 Jan 2011 Link to this post

    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
  5. Alan
    Alan avatar
    107 posts
    Member since:
    Oct 2010

    Posted 24 Jan 2011 Link to this post

    Hi Veronica,

    How can I get the latest internal build?

    Thanks,
    Daryl
  6. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 26 Jan 2011 Link to this post

    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.
  7. Alan
    Alan avatar
    107 posts
    Member since:
    Oct 2010

    Posted 26 Jan 2011 Link to this post

    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
  8. Alan
    Alan avatar
    107 posts
    Member since:
    Oct 2010

    Posted 27 Jan 2011 Link to this post

    Problem (1) happens with or without context menu.
  9. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 27 Jan 2011 Link to this post

    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.
  10. Alan
    Alan avatar
    107 posts
    Member since:
    Oct 2010

    Posted 27 Jan 2011 Link to this post

    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.
  11. Ashley
    Ashley avatar
    3 posts
    Member since:
    Jun 2010

    Posted 27 Jan 2011 Link to this post

    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.
  12. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 27 Jan 2011 Link to this post

    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.
  13. Alan
    Alan avatar
    107 posts
    Member since:
    Oct 2010

    Posted 28 Jan 2011 Link to this post

    Might I also add that even though the application works and compiles, visual studio designer doesn't. 

    See attached photo.
  14. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 28 Jan 2011 Link to this post

    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.
  15. Alan
    Alan avatar
    107 posts
    Member since:
    Oct 2010

    Posted 28 Jan 2011 Link to this post

    Hi Peter,

    Does that apply for visual studio 2010?

    Thanks,
    Daryl
  16. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 28 Jan 2011 Link to this post


    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.
  17. Alan
    Alan avatar
    107 posts
    Member since:
    Oct 2010

    Posted 28 Jan 2011 Link to this post

    Thanks Peter, that fixed my designer problems, unfortunately I still have these.
  18. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 31 Jan 2011 Link to this post

    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.
  19. Alan
    Alan avatar
    107 posts
    Member since:
    Oct 2010

    Posted 31 Jan 2011 Link to this post

    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.
  20. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 31 Jan 2011 Link to this post

    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.
  21. Alan
    Alan avatar
    107 posts
    Member since:
    Oct 2010

    Posted 01 Feb 2011 Link to this post

    Will do, thanks Peter!
  22. Alan
    Alan avatar
    107 posts
    Member since:
    Oct 2010

    Posted 03 Feb 2011 Link to this post

    Could you help with problem 2, or should I create a separate thread? (Viewstate issue)
  23. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 03 Feb 2011 Link to this post

    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.
Back to Top