Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
119 views
Hi!

Is there anyone having experience with the integration of the Telerik AJAX controls and SharePoint 2010?   To make things certain, I've followed the instructions at http://www.telerik.com/help/aspnet-ajax/moss-create-ajax-enabled-sharepoint-webpart-radcontrols.html but I am encountering troubles:

First, i created the prototype in 100% pure ASP.NET 3.5 - no problems at all, behaving well.

Then I simply copy & pasted the source codes from the pure ASP.NET pages into SharePoint Application Pages.  My SharePoint development machine is a virtual image of a windows 2008 R2 server with SP2010, MS SQL 2008 R2 and MS VS2010.  Also in this environment everything is working as it should (see attached images "develop_srv_01" and "develop_srv_02").

But by deploying the *.WSP file to the production ("life") SharePoint server, all of a sudden bloody hell breaks out.

First of all - the Advanced Edit/Insert Form of the RadScheduler component does not open.  I would like to have it as a modal window but that does not work on the production server:  I double click in a TimeSlot of the RadScheduler.  The LoadingPanel indicates that "something happens" and, after a while, it goes back to normal (=no visual indication of business).  However, the AdvacedForm does not open (see attached image "prod_srv_01").

When I now click in the RadCalendar (which is located next to the Scheduler) then a PostBack is posted and - the AdvancedForm opens.  And that's where the fun begins!  In the Advanced Insert/Edit Form that opens this way, everything is going mad literally:

I have 2 resources in the Scheduler: Medics and Treatments.  "Medics" are defined as a single choise resource and "Treatments" are designed as a multiple choice resource.  Again, in the pure ASP.NET prototype and on the development server, everything is OK.  But on the production server (by "opening" the AdvancedForm in this buggy way) this becomes swapped:  Now all of a sudden "Medics" are a multiple choice resource and "Treatments" become a single choice resource (see attached image "prod_srv_02" and compare it against the 2 images from the development server).

In my code behind i instruct the RadScheduler:

 

protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)
{
    try
    {
        RadScheduler1.ResourceTypes.FindByName("Treatment").AllowMultipleValues = true;
        RadScheduler1.ResourceTypes.FindByName("Medic").AllowMultipleValues = false;
     }
     catch (System.Exception ex)
     {
         Logger.SharePointLog.LogEx(ex, "RadScheduler1_AppointmentDataBound");
     }
}

No exception is ever is thrown...

To make things even more complicated, I can easy tell the AdvancedForm not to open as a modal window but "inline" in the scheduler by setting

<AdvancedForm Modal="false"


and now the AdvancedForm does open when I double click a TimeSlot in the RadScheduler!   But again, even then I have the swapping of the single/multiple choice resources!

I've followed the instructions at http://www.telerik.com/help/aspnet-ajax/moss-create-ajax-enabled-sharepoint-webpart-radcontrols.html and modified the 2 web.config files on the production SharePoint server.  Guess those changes must be OK, otherwise I wouldn't see the Telerik AJAX controls on a SP page.  Session and View states are enabled.

My 1st guess was that "something" with the loading of the internal scripts of the Telerik Web UI DLL went wrong.  So i load them manually on every PostBack - without sucess.

Is there anyone out there who has a clue or can point me towards the right direction?  Or even has experienced this or a simmular situation and has sucessfully overcome it?

I don't want to post the whole Page here (there are quite some controls on it), but here is the RadScheduler in question:
<telerik:RadScheduler ID="RadScheduler1" runat="server" 
    SelectedView="MonthView" Culture="de-DE" FirstDayOfWeek="Monday" Height="800px" Width="100%" 
    HoursPanelTimeFormat="H:mm" MinutesPerRow="5" TimeLabelRowSpan="3"
    TimeZoneID="W. Europe Standard Time" TimeZoneOffset="01:00:00" OverflowBehavior="Expand" ColumnWidth="17%"
    WorkDayStartTime="09:00:00" WeekDayEndTime="18:00:00" DataEndField="DtmEnd" DataKeyField="ID" 
    DataStartField="DtmStart" DataSubjectField="Name" DataDescriptionField="Description"
    DataRecurrenceField="RecRule" DataRecurrenceParentKeyField="ID" OnClientAppointmentInserting="OnClientAppointmentInserting"
    Skin="Metro" AppointmentStyleMode="Default" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound"
    OnAppointmentCreated="RadScheduler1_AppointmentCreated" EnableDescriptionField="True" OnFormCreated="RadScheduler1_FormCreated"
    EnableExactTimeRendering="True" DisplayRecurrenceActionDialogOnMove="True" WorkDayEndTime="18:00:00" ShowNavigationPane="false"
    OnTimeSlotCreated="RadScheduler1_TimeSlotCreated" 
    OnAppointmentCommand="RadScheduler1_AppointmentCommand"                          
    WeekView-UserSelectable="False" DayView-UserSelectable="False" MonthView-UserSelectable="False">
    <AdvancedForm Modal="true" Enabled="true" EnableResourceEditing="true" EnableCustomAttributeEditing="true" />
    <ResourceTypes>
        <telerik:ResourceType DataSourceID="SqlDataSourceMedics" ForeignKeyField="Medic" KeyField="ID" Name="Arzt" TextField="Name" />
        <telerik:ResourceType DataSourceID="SqlDataSourceTreatment" ForeignKeyField="Treatment" KeyField="ID" Name="Behandlung" TextField="Description" />
    </ResourceTypes>
    <Localization AdvancedNewAppointment="Neues Zeitfenster" AdvancedEditAppointment="Zeitfenster bearbeiten"
        AdvancedSubject="Betreff" AdvancedDescription="Beschreibung" AdvancedRecurrence="Serie" AdvancedRecurEvery="jeden"
        HeaderDay="Tag" HeaderMonth="Monat" HeaderTimeline="Zeitlinie"
        HeaderToday="Heute" HeaderWeek="Woche" Save="Speichern"
        Show24Hours="24 Stunden Ansicht" ShowBusinessHours="Arbeitszeit Ansicht" />
<AppointmentTemplate>
    <b><%# Eval("Subject") %></b>
    <br /><br />
    <asp:Label runat="server" ID="lblTreatments"></asp:Label>
    <br /><br />
    <asp:Label runat="server" ID="lblMedic"></asp:Label>
</AppointmentTemplate>
</telerik:RadScheduler>

and here is the code behind:

using System;
using System.Globalization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Collections.Generic;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Telerik.Web.UI;
 
namespace ShareVision.SharePoint2010.MedResWebParts.Layouts.MedResWebParts
{
 
    /// <summary>
    /// <para>
    /// MedRes Verwaltung durch Admin - TimeFrames.
    /// </para>
    /// <para>
    /// Ermöglicht das Erstellen von Einmal- und Serienterminen (=Behandlungen) durch den Arzt.
    /// </para>
    /// </summary>
    public partial class MgmtTimeFrame : LayoutsPageBase
    {
        /// <summary>
        /// Für 1:n Beziehungen kann der Telerik Scheduler keine automatische Datenbindung.
        /// Vielmehr muss man hierzu einen eigenen FactoryProvider erstellen welcher diese 1:n Zuordnung pflegt (insert/delete).
        /// </summary>
        private MedResSchedulerProvider provider;
 
        protected void Page_Init(object sender, EventArgs e)
        {
            //EnsureChildControls();
            provider = new MedResSchedulerProvider();
            provider.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["MedResConnectionString"].ConnectionString;
 
            this.RadScheduler1.Provider = provider;
 
            System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
        }
 
 
        private ScriptManager CheckScriptManager()    
        {
            Page.ClientScript.RegisterStartupScript(typeof(MgmtTimeFrame), this.ID, "_spOriginalFormAction = document.forms[0].action;_spSuppressFormOnSubmitWrapper=true;", true);
            if (this.Page.Form != null)
            {
                string formOnSubmitAtt = this.Page.Form.Attributes["onsubmit"];
                if (!string.IsNullOrEmpty(formOnSubmitAtt) && formOnSubmitAtt == "return _spFormOnSubmitWrapper();")
                {
                    this.Page.Form.Attributes["onsubmit"] = "_spFormOnSubmitWrapper();";
                }
            }
 
 
            ScriptManager scriptManager = ScriptManager.GetCurrent(Page);
            if (scriptManager == null)
            {
                if (Page.Form != null)
                {
                    scriptManager = new ScriptManager();
                    scriptManager.ID = Page.Form.ID + "_ScriptManager";
                    Page.Form.Controls.Add(scriptManager);
                }
            }
 
            if (scriptManager != null)
            {
                string telerikAssembly = typeof(RadScheduler).Assembly.FullName;
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Common.Core.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Common.jQuery.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Common.jQueryPlugins.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Common.Popup.PopupScripts.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Common.Navigation.NavigationScripts.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Menu.RadMenuScripts.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Menu.ContextMenu.RadContextMenuScripts.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Input.TextBox.RadInputScript.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Input.DateInput.RadDateInputScript.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Input.NumericTextBox.RadNumericInputScript.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Calendar.RadTimeViewScripts.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Calendar.RadCalendarCommonScript.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Calendar.RadCalendarScript.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Calendar.RadDatePicker.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Calendar.RadDateTimePickerScript.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.ComboBox.RadComboBoxScripts.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Helpers.DateTime.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.RadSchedulerScripts.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.RecurrenceEditor.RecurrenceEditor.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Week.Model.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Week.GroupedByResource.Model.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Week.GroupedByDate.Model.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.MultiDay.Model.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.MultiDay.GroupedByResource.Model.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.MultiDay.GroupedByResource.Model.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Day.Model.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Day.GroupedByResource.Model.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Month.Model.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Month.GroupedByResource.Model.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Month.GroupedByDate.Model.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Timeline.Model.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Timeline.GroupedByResource.Model.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Timeline.GroupedByDate.Model.js", telerikAssembly));
                scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Scheduling.AdvancedTemplate.js", telerikAssembly));
            }
            return scriptManager;
        }    
 
 
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    CheckScriptManager();
 
                    RadScheduler1.ReadOnly = false;
                    RadScheduler1.AllowEdit = true;
                    RadScheduler1.AllowInsert = true;
 
                    RadScheduler1.StartEditingInAdvancedForm = true;
                    RadScheduler1.StartInsertingInAdvancedForm = true;
                }
            }
            catch (System.Exception ex)
            {
                Logger.SharePointLog.LogEx(ex, "MgmtTimeFrame - PageLoad");
            }
        }
 
 
        /// <summary>
        /// Button to go back to MedRes Admin Menu.
        /// If session has expired, go 1 step backwards.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void btnMenuLink_Click(object sender, ImageClickEventArgs e)
        {
            string url = "";
 
            if (Session[UsedSessionVarNames.AdminViewMainMenu] != null)
                url = Session[UsedSessionVarNames.AdminViewMainMenu].ToString();
            else
                url = "javascript:history.back();";
 
            Response.Redirect(url);
        }
 
 
        /// <summary>
        /// RadSchedular: Resourcen "Style" verwalten: Treatments = multiple choise, Medic = single choise
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)
        {
            try
            {
                // TODO: Diese "Farb-Bindung" geht nur bei 1:1 Resourcen; wir haben jetzt 1:n --> wie eine entspr. Farbe auswählen?
                //if (e.Appointment.Resources.GetResourceByType("Behandlung") != null)
                //{
                //  DataRowView x = (DataRowView)e.Appointment.Resources.GetResourceByType("Behandlung").DataItem;
                //  e.Appointment.BackColor = ColorTranslator.FromHtml(x.Row["Color"].ToString());
                //  e.Appointment.ForeColor = Color.Black;
                //}
 
                RadScheduler1.ResourceTypes.FindByName("Treatment").AllowMultipleValues = true;
                RadScheduler1.ResourceTypes.FindByName("Medic").AllowMultipleValues = false;
            }
            catch (System.Exception ex)
            {
                Logger.SharePointLog.LogEx(ex, "RadScheduler1_AppointmentDataBound");
            }
        }
 
 
 
        protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e)
        {
            //Logger.SharePointLog.LogMsgDebug("Entering RadScheduler1_AppointmentCreated");
 
            if (e.Appointment != null && e.Appointment.Resources.Count > 0)
            {
                try
                {
                    List<string> behandlung = new List<string>();
                    foreach(Resource treat in e.Appointment.Resources.GetResourcesByType("Treatment"))
                    {
                        behandlung.Add(treat.Text);
                    }
 
                    if(behandlung.Count > 0)
                    {
                        Label assignedTo = (Label)e.Container.FindControl("lblTreatments");
                        assignedTo.Text = "Behandlung(-en):<br>" + string.Join(", ", behandlung.ToArray());
                    }
 
                    Resource medic = e.Appointment.Resources.GetResourceByType("Medic");
                    if(medic != null)
                    {
                        Label location = (Label)e.Container.FindControl("lblMedic");
                        location.Text = "Arzt: " + medic.Text;
                    }
 
                    e.Appointment.CssClass = "rsCategoryBlue";
                    e.Appointment.BackColor = System.Drawing.Color.PapayaWhip;
                }
                catch (System.Exception ex)
                {
                    Logger.SharePointLog.LogMsgDebug("RadScheduler1_AppointmentCreated -- 1. Exception Schleife");
                    Logger.SharePointLog.LogEx(ex);
                }
 
                // Wenn es ein Appointment im Scheduler gibt, im kleinen Kalender den Tag als "special day" kennzeichnen
                try
                {
                    RadCalendarDay calendarDay = new RadCalendarDay();
                    calendarDay.Date = e.Appointment.Start;
                    calendarDay.IsSelectable = true;
                    calendarDay.ToolTip = e.Appointment.Subject;
                    calendarDay.ItemStyle.CssClass = "rcOrdination";
                    RadCalendar1.SpecialDays.Add(calendarDay);
 
                    RadCalendar SchedulerDetailCalendar = this.RadCalendar1.FindControl("SelectedDateCalendar") as RadCalendar;
 
                    if (SchedulerDetailCalendar != null)
                        SchedulerDetailCalendar.SpecialDays.Add(calendarDay);
                }
                catch(System.Exception ex)
                {
                    Logger.SharePointLog.LogMsgDebug("RadScheduler1_AppointmentCreated -- 2. Exception Schleife");
                    Logger.SharePointLog.LogEx(ex);
                }
            }
 
            //Logger.SharePointLog.LogMsgDebug("Leaving RadScheduler1_AppointmentCreated");
        }
 
 
        /// <summary>
        /// Per default, "all day" event is beeing checked (only) in Month view.  This is the default TELERIK AJAX RadScheduler behaviour.
        /// Here we disable this by manually hooking into the correspondending control (=unchecking the checkbox via code).
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
        {
            try
            {
                Logger.SharePointLog.LogMsgDebug("RadScheduler1_FormCreated() - entering");
 
                if (e.Container.Mode == SchedulerFormMode.AdvancedEdit || e.Container.Mode == SchedulerFormMode.AdvancedInsert)
                {
                    CheckBox allDayCheckbox = (CheckBox)e.Container.FindControl("AllDayEvent");
                    allDayCheckbox.Checked = false;
                    allDayCheckbox.Style.Add("visibility", "hidden");
 
                    RadDatePicker startTime = e.Container.FindControl("StartTime") as RadDatePicker;
                    if (startTime != null)
                    {
                        startTime.Enabled = true;
                        startTime.Visible = true;
                    }
 
                    RadDatePicker endTime = e.Container.FindControl("EndTime") as RadDatePicker;
                    if (endTime != null)
                    {
                        endTime.Enabled = true;
                        endTime.Visible = true;
                    }
 
                    //Resource medic = e.Appointment.Resources.GetResourceByType("ResMedic");
                    //if (medic != null)
                    //{
                    //    Label location = (Label)e.Container.FindControl("lblMedic");
                    //    location.Text = "Arzt: " + medic.Text;
 
                    //    RadTextBox attrAnnotationsTextbox = (RadTextBox)e.Container.FindControl("ResMedic");
                    //    attrAnnotationsTextbox.Label = "ARZT: ";
                    //}
 
                    //RadTextBox lblMedic = (RadTextBox)e.Container.FindControl("ResMedic");
                    //if (lblMedic != null)
                    //{
                    //    lblMedic.Label = "ARZT: ";
                    //}
 
                    //RadTextBox lblTreatment = (RadTextBox)e.Container.FindControl("ResTreatment");
                    //if (lblTreatment != null)
                    //{
                    //    lblTreatment.Label = "Behandlung: ";
                    //}
 
                    if (e.Container.Mode == SchedulerFormMode.AdvancedInsert)
                    {
                        startTime.SelectedDate = DateTime.Now;
                        endTime.SelectedDate = DateTime.Now.AddHours(2);
                    }
 
                    //try
                    //{
                    //    this.RadScheduler1.ShowAdvancedEditForm(new Appointment());
                    //}
                    //catch(Exception ex)
                    //{
                    //    Logger.SharePointLog.LogEx(ex, "RadScheduler1_FormCreated() -- ShowAdvancedEditForm(new Appointment()) failed");
                    //}
 
                }
                Logger.SharePointLog.LogMsgDebug("RadScheduler1_FormCreated() - leaving.");
            }
            catch (Exception ex)
            {
                Logger.SharePointLog.LogEx(ex, "RadScheduler1_FormCreated()");
            }
        }
 
 
        /// <summary>
        /// Im kleinen RadCalendar wurde ein neues Datum ausgewählt, weiterleiten an den RadScheduler.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void RadCalendar1_SelectionChanged(object sender, Telerik.Web.UI.Calendar.SelectedDatesEventArgs e)
        {
            try
            {
                RadScheduler1.SelectedDate = e.SelectedDates[0].Date;
            }
            catch (System.Exception ex)
            {
                Logger.SharePointLog.LogEx(ex);
            }
        }
 
 
        /// <summary>
        /// Im kleinen RadCalendar wurde ein neues Monat od. Jahr ausgewählt, weiterleiten an den RadScheduler.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void RadCalendar1_DefaultViewChanged(object sender, Telerik.Web.UI.Calendar.DefaultViewChangedEventArgs e)
        {
            try
            {
                RadScheduler1.SelectedDate = RadCalendar1.FocusedDate;
            }
            catch (System.Exception ex)
            {
                Logger.SharePointLog.LogEx(ex);
            }
        }
 
 
        /// <summary>
        /// Render Holidays in the small calendar.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void RadCalendar1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
        {
            try
            {
                SqlDataSourceCheckHolidays.SelectParameters[0].DefaultValue = e.Day.Date.ToShortDateString();
                DataView view = (DataView)SqlDataSourceCheckHolidays.Select(DataSourceSelectArguments.Empty);
 
                if (view != null)
                {
                    DataTable table = view.ToTable();
                    if (table.Rows.Count > 0)
                    {
                        e.Cell.ToolTip = table.Rows[0]["Name"].ToString();
                        e.Cell.CssClass = "rcWeekend";
                    }
                }
            }
            catch (System.Exception ex)
            {
                Logger.SharePointLog.LogEx(ex);
            }
        }
 
 
        /// <summary>
        /// Wenn das Datum ein Feiertag ist, den Tag zum Bearbeiten sperren.
        /// </summary>
        /// <remarks>
        /// Unbedingt beim TimeSlot +1 Stunde dazu zählen, da das Datum in der Datenbank wegen
        /// Telerik Ctrls um 1 Stunde "verschoben" gespeichert wird.
        /// </remarks>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void RadScheduler1_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
        {
            try
            {
                SqlDataSourceCheckHolidays.SelectParameters[0].DefaultValue = e.TimeSlot.Start.AddHours(1).ToShortDateString();
                DataView view = (DataView)SqlDataSourceCheckHolidays.Select(DataSourceSelectArguments.Empty);
 
                if (view != null)
                {
                    DataTable table = view.ToTable();
 
                    if (table.Rows.Count > 0)
                    {
                        string holidayName = table.Rows[0]["Name"].ToString();
 
                        if (!string.IsNullOrEmpty(holidayName))
                        {
                            e.TimeSlot.CssClass = "Disabled";
                            e.TimeSlot.Control.ToolTip = holidayName;
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                Logger.SharePointLog.LogEx(ex);
            }
        }
 
 
 
        /// <summary>
        /// Export a single appointment to iCalendar file
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void RadScheduler1_AppointmentCommand(object sender, AppointmentCommandEventArgs e)
        {
            Logger.SharePointLog.LogMsgDebug("RadScheduler1_AppointmentCommand() -- START.");
            Logger.SharePointLog.LogMsgDebug("Command: " + e.CommandName);
 
            if (e.CommandName == "Insert")
            {
                Logger.SharePointLog.LogMsgDebug(" >>  Command = INSERT");
            }
            else if(e.CommandName == "CmdInsert")
            {
                Logger.SharePointLog.LogMsgDebug(" >>  Command = CmdInsert");
            }
            else if (e.CommandName == "Create")
            {
                Logger.SharePointLog.LogMsgDebug(" >>  Command = Create");
            }
            else if (e.CommandName == "CmdCreate")
            {
                Logger.SharePointLog.LogMsgDebug(" >>  Command = CmdCreate");
            }
 
            Logger.SharePointLog.LogMsgDebug("RadScheduler1_AppointmentCommand() -- END.");
        }
 
    }
}



Any help would be appreciated.
Helen
Telerik team
 answered on 02 Jan 2013
1 answer
97 views
Hi,
I am using the RadAjaxManager and RadGrid,
In the page, i have a button, on clicking it, i am changing the view as below:
CustomMultiView.ActiveViewIndex = 1;

I am getting the below javascript error:

Message: Sys.ArgumentNullException: Value cannot be null.
Parameter name: panelsCreated[3]
Line: 129
Char: 12
Code: 0
URI: server/ScriptResource.axd?d=RPebyLkP-fhDCOP8R5TjxWPY-4fkPjRpQKETtPt1vJ0oYKjzG0P1oXDrWwqGUYowJk6FNzcl9JDcrVPqxhlevrLUyg2lficlL2Y9_KKnDvF49irZMVbCoI5gJzWm8v_Unf6FfAqjKOclBxnSZZAf9ybMAzMisFKw_edGwuOokTcB0Hr10&t=ffffffffb868b5f4

I am using Sharepoint 2010. I have seen the below url:
http://www.telerik.com/community/forums/sharepoint-2010/integrate-ajax-controls/telerik-ajax-issue-with-sharepoint-2010.aspx

However the changes provided in the url have not helped. How to fix this?
Thanks
Marin
Telerik team
 answered on 02 Jan 2013
1 answer
81 views
Hello,
Is it possible to find the word/char/page count of the uploaded file?

Thanks and Regards,
VanDaniel
Princy
Top achievements
Rank 2
 answered on 02 Jan 2013
12 answers
1.1K+ views
Hi,

I have a radGrid being created dynamically .

Now , the data source is a dataTable that gets created dynamically. I have no control over what is going to be there in the datatable. the only thing that I know about it is that its a dataTable, that's it.

Now based on the number of colulmns I have in the DataTable, I need to have those columns being dynamically generated as dataBoundColumns for my grid.

In other words I need to create all the data columns in my RadGrid dynamically from the DataTable .

Also, can the text cell in the RadGrid row be replaced by an image based on the text. Eg, if text or value inside cell is "ABC", then I should be able to replace it with a clickable image.

Please let me know how can this accomplished.

Thanks
Princy
Top achievements
Rank 2
 answered on 02 Jan 2013
1 answer
118 views

Hello,

I'm attempting to use the RadGrid filtering with the RadFilter demo to recreate the example myself but unfortunately the filter doesn't apply at all when I attempt to apply it. Here's a copy of the aspx page:

<form id="PageForm" runat="server">
        <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
        <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadFilter1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadFilter1"></telerik:AjaxUpdatedControl>
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1"></telerik:AjaxUpdatedControl>
                        <telerik:AjaxUpdatedControl ControlID="SqlDataSource1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1"></telerik:RadAjaxLoadingPanel>
        <div class="filterDiv">
            <telerik:RadFilter runat="server" ID="RadFilter1" FilterContainerID="RadGrid1" ShowApplyButton="false"></telerik:RadFilter>
        </div>
 
        <telerik:RadGrid runat="server" ID="RadGrid1" AutoGenerateColumns="false" DataSourceID="SqlDataSource1"
            AllowPaging="true" AllowSorting="true" AllowFilteringByColumn="true" OnItemCommand="RadGrid1_ItemCommand">
            <MasterTableView IsFilterItemExpanded="false" CommandItemDisplay="Top">
                <CommandItemTemplate>
                    <telerik:RadToolBar runat="server" ID="RadToolBar1" OnButtonClick="RadToolBar1_ButtonClick">
                        <Items>
                            <telerik:RadToolBarButton Text="Apply filter" CommandName="FilterRadGrid" />
                        </Items>
                    </telerik:RadToolBar>
                </CommandItemTemplate>
                <Columns>
                    <telerik:GridNumericColumn DataField="PreferenceID" HeaderText="PreferenceID" />
                    <telerik:GridNumericColumn DataField="UserID" HeaderText="UserID" DataType="System.Int32" />
                    <telerik:GridNumericColumn DataField="SiteID" HeaderText="SiteID" DataType="System.Int32" />
                    <telerik:GridBoundColumn DataField="Value" HeaderText="Value" />
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
        <asp:SqlDataSource runat="server" ID="SqlDataSource1" SelectCommand="Select PreferenceID, UserID, SiteID, Value FROM iWeb..TAB_Preference"
        ConnectionString="<%$ ConnectionStrings:iWeb %>"  />
 
    </form>

Here's the code-behind page:

Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs)
    If e.CommandName = "FilterRadGrid" Then
        RadFilter1.FireApplyCommand()
    End If
End Sub
 
Protected Sub RadToolBar1_ButtonClick(ByVal source As Object, ByVal e As RadToolBarEventArgs)
 
End Sub

Here's a link to the example I'm using:

http://demos.telerik.com/aspnet-ajax/filter/examples/integration/defaultvb.aspx?product=filter

Any help would be greatly appreciated.

Vasil
Telerik team
 answered on 02 Jan 2013
1 answer
125 views
I am creating a webpart that has a radlistview on it.  It uses a webservice (actually a generic handler because I cant figure out how to make a webservice actually return proper json and not xml) to get its data.  That works perfectly.  I have now added a raddatapager into my layouttemplate and I know that it is sort of working because if i change the pagesize member in the raddatapager, it does change the amount of records that come back.  The only problem: none of the buttons are showing up in my datapager.

Here is a snippet of code:

Main code to build the RadListView
private void BuildResultPanel()
        {
            _mppUserListView = new Telerik.Web.UI.RadListView()
                                  {
                                      ID = "MPPUserResultList",
                                      RegisterWithScriptManager = true,
                                      AllowPaging = true
                                  };
            var mainDiv = new HtmlGenericControl("Div");
            mainDiv.Attributes.Add("style", "overflow:hidden;border:1px solid black;padding:5px;margin-top:15px");
            this.Controls.Add(mainDiv);
            mainDiv.Controls.Add(_mppUserListView);
            _mppUserListView.LayoutTemplate = new PhotoUploadLayoutTemplate();
            var photoUploadResultItemTemplate = new PhotoUploadResultItemTemplate();
            var container = new Control();
            photoUploadResultItemTemplate.InstantiateIn(container);
            var s = RenderControl(container);
            //_mppUserListView.ItemTemplate = photoUploadResultItemTemplate;
            //_mppUserListView.ItemPlaceholderID = "items";
            _mppUserListView.ClientSettings.DataBinding.ItemTemplate = s;
            _mppUserListView.ClientSettings.DataBinding.ItemPlaceHolderID = "items";
            _mppUserListView.ClientSettings.DataBinding.DataService.Location = "/_layouts/services/MPPusersPhotoBioUpload/MPPUsers.ashx";
            _mppUserListView.ClientSettings.DataBinding.DataService.DataPath = "GetMPPUsers";
            if (MIAjax != null) MIAjax.AjaxSettings.AddAjaxSetting(_mppUserListView, _mppUserListView, MIAjaxLoader);
        }

PhotoUploadLayoutTemplate:
public void InstantiateIn(Control container)
        {
            var dataPager = new RadDataPager { PagedControlID = "MPPUserResultList",
                ID = "MPPUserResultList_pagerTop", PageSize = 20 };
            dataPager.Fields.Add(new RadDataPagerButtonField() { FieldType = PagerButtonFieldType.FirstPrev });
            dataPager.Fields.Add(new RadDataPagerButtonField() { FieldType = PagerButtonFieldType.Numeric, PageButtonCount = 5 });
            dataPager.Fields.Add(new RadDataPagerButtonField() { FieldType = PagerButtonFieldType.NextLast });
            container.Controls.Add(dataPager);
...
}

The raddatapager does render and shows a nice rectangle.. BUT NO BUTTONS!! :(

Please let me know what I am doing wrong.  I have the ajaxmanager on the page, the radscriptmanager.  And it would appear I have it right since the ajax call is being made and the result list is showing the first 10 or 20 records (depending on my pagesize).  I just want to know why the buttons are not showing up.  And its not a CSS thing because I can see in the HTML that they arent rendering at all.

Thanks
Loren
Kostadin
Telerik team
 answered on 02 Jan 2013
1 answer
92 views
I have an example:

If I address the link http://domain.com/index.aspx, RadComboBox works fine and everything is smooth. But I implement the URL Rewrite and browse the link http://domain.com/home-page.html, RadComboBox shows javascript error message when I type the chracter ('). It shows "Incorrect syntax near 's'. Unclosed quotation mark...".

Please see an attachment and help me fix this issue.

P/S: I am using RewriteModule (written by C# DEV) not use IIS Rewrite module.

Thanks
Helen
Telerik team
 answered on 02 Jan 2013
6 answers
780 views
Hello,

I have implemented RadTreeList client side selection functionality, which does as follows: 

1. When i select Parent, it select all child.
2. When I deselect Parent, it deselect all child.
3. When I deselect child, No effect occurs. All selection remains as it is except current selection.
4. When I select the child, It should select parent item of that child not all child.

Now I using this script I can get first 3 rules but cannot get 4th one.

Here I have created Script as bellow:

Script:

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function OnClientNodeClicked(sender, args) {
            var currNode = args.get_item();
            var childNodes = currNode.get_childItems();
            var nodeCount = currNode.get_childItems().length;
            if (nodeCount > 0) {
                var isChecked = currNode.get_selected();
                UpdateAllChildren(currNode, childNodes, nodeCount, isChecked);
            }
        }
 
        function UpdateAllChildren(currNode, nodes, nodecount, checked) {
            var i;
            for (i = 0; i < nodecount; i++) {
                if (checked) {
                    nodes[i].set_selected(true);
                }
                else {
                    nodes[i].set_selected(false);
                }
            }
        }
    </script>
</telerik:RadCodeBlock>


RadTreeList HTML:

<telerik:RadTreeList ID="rtlBusinessUnit" runat="server" DataKeyNames="Business_Unit_ID"
                    ClientSettings-AllowPostBackOnItemClick="false" OnNeedDataSource="rtlBusinessUnit_OnNeedDataSource"
                    ParentDataKeyNames="ParentBUID" OnItemCreated="rtlBusinessUnit_OnItemCreated"
                    OnItemDataBound="rtlBusinessUnit_OnItemDataBound" AutoGenerateColumns="false"
                    AllowMultiItemSelection="true">
                    <Columns>
                        <telerik:TreeListSelectColumn HeaderStyle-Width="38px" UniqueName="BussinessUnitCheckboxes">
                        </telerik:TreeListSelectColumn>
                        <telerik:TreeListBoundColumn DataField="Business_Unit_ID" HeaderText="Business_Unit_ID"
                            Visible="false" UniqueName="Business_Unit_ID" />
                        <telerik:TreeListBoundColumn DataField="LegalName" HeaderText="Name" UniqueName="LegalName" />
                        <telerik:TreeListBoundColumn DataField="Business_Unit_ID" HeaderText="Business_Unit_ID"
                            Visible="false" UniqueName="Business_Unit_ID" HeaderStyle-Width="80px" />
                    </Columns>
                    <ClientSettings>
                        <ClientEvents OnItemSelected="OnClientNodeClicked" OnItemDeselected="OnClientNodeClicked" />
                        <Selecting AllowItemSelection="true" />
                        <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" ScrollHeight="300" />
                    </ClientSettings>
                </telerik:RadTreeList>

Marin
Telerik team
 answered on 02 Jan 2013
2 answers
140 views
I have a number of combo boxes on a web page that are all defined the same.

<telerik:RadComboBox   
ID="ListingState"   
TabIndex="4"   
EnableEmbeddedSkins="true"   
Skin="Black"   
runat="server"   
Width="250px"   
MarkFirstMatch="true"   
Height="200px"   
ToolTip="Select your state/province."   
OnClientSelectedIndexChanging="LoadCities"   
OnItemsRequested="ListingState_ItemsRequested" 
OnClientItemsRequested="ItemsLoaded" 
> 
</telerik:RadComboBox> 

Basically, all the combo boxes are setup to allow the user to key in their desired selection and have the combo box  move to that item.
When these combo boxes are populated, the "text" is populated using a string (such as Province/State name as in the above) and the "value" is populated using an Integer value that is the key to the database record represented in the combo box.

If the user keys in the desired value and, when the combo box locates the desired item, then the user tabs out of the field, the "combobox.selected value" is not being set and the cannot be retrieved (the code behind "blows up" because there is no integer value obtained from the selected value).  The "selected value" property returns a null value.

However, if the user mouse clicks on a specific item in the combo box, then the :selectedvalue" property returns the integer value and the code behind works fine.

Why?  If the user locates an item by keying and then tabs out, how do I pick up the value of the item that is displayed in the combo box and how do I know that this event has occurred?

Thanks in advance!

Lynn
Amjad
Top achievements
Rank 1
 answered on 02 Jan 2013
0 answers
78 views
hi,

i am new in telerik world, i have rad grid, whose first column as a check box, and another as rad numeric text box, which is disabled by default and got enabled only when the check box is checked. And i have one check box in the header template of the first column to check all. my scenario is like this.
i checked the header checkbox and changed one text box value, after that i unchecked the checkbox of that row, i need to rebind that row only, meaning i have to get back the old value in the rad numeric text box, is it possible? pls help.
am pasting my code below
protected void SelectAll_CheckedChangedEvent(object sender, EventArgs e)
        {
           CheckBox SelectAll = sender as CheckBox;
           foreach (GridItem item in grdOnDSelection.Items)
           {
             if (SelectAll.Checked == true)
               {
                  CheckBox chk = (CheckBox)item.Cells[2].FindControl("chkOnDSelection");
                   chk.Checked = true;
                    RadNumericTextBox txtDsicountPercent = (RadNumericTextBox)item.Cells[7].FindControl("txtDsicountPercent");
                        txtDsicountPercent.Enabled = true;
                    }
                    else
                    {
                        RadNumericTextBox txtDsicountPercent = (RadNumericTextBox)item.Cells[7].FindControl("txtDsicountPercent");
                        txtDsicountPercent.Enabled = false;
 
                        grdOnDSelection.Rebind();
                    }
                }
           
        }
 
protected void chkOnDSelection_checkedChangedEvent(object sender, EventArgs e)
 {
((sender as CheckBox).NamingContainer as GridItem).Selected = (sender as CheckBox).Checked;
                CheckBox chk = sender as CheckBox;
                GridItem item = chk.NamingContainer as GridItem;
                if (chk.Checked && item.Cells[7].FindControl("txtDsicountPercent") is RadNumericTextBox)
                {
                    RadNumericTextBox txtDsicountPercent = (RadNumericTextBox)item.Cells[7].FindControl("txtDsicountPercent");
                    txtDsicountPercent.Enabled = true;
                }
                if (chk.Checked == false && item.Cells[7].FindControl("txtDsicountPercent") is RadNumericTextBox)
                {
                    RadNumericTextBox txtDsicountPercent = (RadNumericTextBox)item.Cells[7].FindControl("txtDsicountPercent");
                    txtDsicountPercent.Enabled = false;
                    //grdOnDSelection.Rebind();//all chkboxes will be deselected
                }
}
Ami
Top achievements
Rank 1
 asked on 02 Jan 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?