RadCalendar in Web Part

5 posts, 0 answers
  1. Jim
    Jim avatar
    8 posts
    Member since:
    Nov 2008

    Posted 24 Nov 2008 Link to this post

    Hi,

    I’m trying to test a RadCalendar in a SharePoint Web Part using Visual Studio.2008. I downloaded the controls and installed them in Visual Studio and added them to the ToolBox. Since I’m creating a Web Part for SharePoint and not an aspx page I can’t just drag the control onto the form. Here is what I have in WebPart1.cs.

     

    using System;

    using System.Runtime.InteropServices;

    using System.Web.UI;

    using System.Web.UI.WebControls;

    using System.Web.UI.WebControls.WebParts;

    using System.Xml.Serialization;

     

    using Microsoft.SharePoint;

    using Microsoft.SharePoint.WebControls;

    using Microsoft.SharePoint.WebPartPages;

     

    using Telerik.Web.UI; //I added this line

     

    namespace TestWebPart1

    {

        [Guid("e8868eb7-8a0c-4f34-bf2e-a156fd713991")]

        public class WebPart1 : System.Web.UI.WebControls.WebParts.WebPart

        {

            public WebPart1()

            {

            }

     

            protected override void CreateChildControls()

            {

                base.CreateChildControls();

     

                // This is working. Commented out to try RadCalendar

                // Calendar helloCalendar = new Calendar();

                // helloCalendar.Enabled = true;

                // helloCalendar.ShowGridLines = true;

                // helloCalendar.EnableViewState = true;

                // helloCalendar.SelectedDate = DateTime.Now;

     

                // RadCalendar calendar = new RadCalendar(); // Got error here

                // calendar.ID = "myCalendar";

                // calendar.RadControlsDir = "~/layouts/RadControls";

                // populate your grid based on your requirements

                // Controls.Add(calendar);

     

                // TODO: add custom rendering code here.

                 // Label label = new Label();

                 // label.Text = "Hello World";

                 // this.Controls.Add(label);

            }

            protected override void RenderWebPart(HtmlTextWriter output)

            {

                EnsureChildControls();

                RenderChildren(output);

            }

        }

    }

     

     

    The 'using Telerik.Web.UI;' works ok but I get the following error message when I uncomment this line, RadCalendar calendar = new RadCalendar();

     

    The type or namespace name 'RadCalendar' could not be found (are you missing a using directive or an assembly reference?)    

     

    Any thought on how to solve this?

     

    Thanks

  2. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 25 Nov 2008 Link to this post

    Hello Jim,

    It seems that you have not registered the Telerik.Web.UI assembly and the Telerik.Web.UI namespace respectively. Please follow the instructions from the 'Integrating RadControls in MOSS' chapter in the online documentation to eliminate the error you receive:

    http://www.telerik.com/help/aspnet-ajax/introduction.html

    Best regards,
    Sebastian
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Jim
    Jim avatar
    8 posts
    Member since:
    Nov 2008

    Posted 25 Nov 2008 Link to this post

    Sebastian,
     
    First, thanks for your help.

    I made all the changes to the web.config from your documentataion. There were a lot of additions so I tried to be very careful. I renamed the web.config and then copied the modified one into the folder. I started with the <sectionGroup additions and ended with everything just before <configuration>

    But I'm still getting the same error.

     

    Is there anything else I need to do?

     

    Jim

    Below is the error I'm getting 


    Configuration Error

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

    Source Error:

     

    Line 154:      <assemblies>

    Line 155:        <add assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />

    Line 156:        <add assembly="System.Web.Extensions, Version=1.0.61025.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

    Line 157:      </assemblies>

    Line 158:      <expressionBuilders>


    Source File: C:\Inetpub\wwwroot\wss\VirtualDirectories\80\web.config    Line: 156

    Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.

     

    WRN: Assembly binding logging is turned OFF.

    To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.

    Note: There is some performance penalty associated with assembly bind failure logging.

    To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

     

  4. Sasa Glamatovic
    Sasa Glamatovic avatar
    2 posts
    Member since:
    Jan 2006

    Posted 05 Dec 2008 Link to this post

    Try installing .Net Ajax?! from http://ajax.asp.net
  5. Jim
    Jim avatar
    8 posts
    Member since:
    Nov 2008

    Posted 05 Dec 2008 Link to this post

    I'm working in a lab environment with SharePoint installed which I did not create. We have Visual Studio.2008 installed but for some reason we only seems to have ASP.NET and .NET Framework versions 1.1 and 2.0. I can't find 3.5 anywhere even thought it normally gets installed with Visual Studio.2008. I know the controls were created for the 3.5 versions. I'm going to try testing in another environment to see if I can solve this.

    Thanks for the help.  

    I'm making some progress with my current environment. Below is the code I added that I got from Telerik documentation.

               RadCalendar calendar = new RadCalendar();

               calendar.ID = "myCalendar";

               calendar.Enabled = true;

               calendar.EnableViewState = true;

               calendar.SelectedDate = DateTime.Now;

               // calendar.RadControlsDir = "~/layouts/RadControls";

               // populate your grid based on your requirements

               Controls.Add(calendar);

    I had an error with the first statement but solved it by adding the following References. Telerik.Web.UI and System.Web.Extensions. To find the first one I had to browse c:\Program Files\Telerik\RadControls for ASPNET AJAX Q3 2008\bin35. Telerik.Web.UI.dll was the only one in there so that doesn’t solve the next problem.

    But I still can't get this line to work when I uncomment it.
    calendar.RadControlsDir = "~/layouts/RadControls";

    This is the error I get when I uncomment the above line.

    Error 1     'Telerik.Web.UI.RadCalendar' does not contain a definition for 'RadControlsDir' and no extension method 'RadControlsDir' accepting a first argument of type 'Telerik.Web.UI.RadCalendar' could be found (are you missing a using directive or an assembly reference?) D:\xxxx\Visual Studio 2008\RadCalendar1\RadCalendar1\RadCalendar1\RadCalendar1.cs      33    22    RadCalendar1

Back to Top