Problem Inserting Resource Type values into DB

15 posts, 0 answers
  1. Justin
    Justin avatar
    20 posts
    Member since:
    Jul 2011

    Posted 20 Aug 2012 Link to this post

    Hi I am new-ish to teleriks tools so I will try my best to describe the problem I am having.

    I am using telerik radscheduler that uses SQL datasource objects for its datasource. I want to be able to add a dropdown list of generic commands that the user can select from and subsequently save. I have added a resourcetype as follows:

    <telerik:ResourceType ForeignKeyField="id"
                  KeyField="id" Name="Commands" TextField="CommandName" />
          </ResourceTypes>

    Per one of your demos I am using the Form Created Event to fill the dropdown with the list of commands. Like this:

    protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
            {
                if ((e.Container.Mode == SchedulerFormMode.AdvancedEdit) || (e.Container.Mode == SchedulerFormMode.AdvancedInsert))
                {
                    
                    RadComboBox ddlCommands = (RadComboBox)e.Container.FindControl("ResCommands");
                    if (ddlCommands != null)
                    {
                        int assetID = int.Parse(Request.QueryString["id"]);
                        string portal = (string)Session["Portal"];
                        AssetFactory assetFactory = new AssetFactory(portal);
                         
                        ddlCommands.DataSource = CommandEnums.GetListItems(assetFactory.GetAssetType(assetID));
                        ddlCommands.DataTextField = "Text";
                        ddlCommands.DataValueField = "Value";
                        ddlCommands.DataBind();
                    }
    }

    When I click the save button I get this error: Invalid length for a Base-64 char array.

    Thread information:

        Thread ID: 12

        ...

        Is impersonating: False

        Stack trace:    at System.Convert.FromBase64String(String s)

       at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)

       at System.Web.UI.LosFormatter.Deserialize(String input)

       at Telerik.Web.UI.LosSerializer.Deserialize(String serializedObject, Boolean enableMacValidation)

       at Telerik.Web.UI.LosSerializer.Deserialize(String serializedObject)

       at Telerik.Web.UI.AdvancedTemplate.ExtractResourceValues(IDictionary target)

       at Telerik.Web.UI.AdvancedTemplate.ExtractValues(Control container)

       at Telerik.Web.UI.RadScheduler.UpdateAppointmentInline(Boolean removeExceptions)

       at Telerik.Web.UI.RadScheduler.OnBubbleEvent(Object source, EventArgs args)

       at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)

       at System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)

       at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)

       at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)

       at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)

       at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)

       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


    Do you have any ideas what I may be doing wrong?

    Here is the whole page code:
    <telerik:RadScheduler ID="RadScheduler1" runat="server" DataEndField="End"
            DataKeyField="ID" DataRecurrenceField="RecurrenceRule"
            DataRecurrenceParentKeyField="RecurrenceParentID" DataSourceID="SchedulerDataSource"
            DataDescriptionField="Description"
            Height="700px"
            OnAppointmentCommand="RadScheduler1_AppointmentCommand"
            StartInsertingInAdvancedForm="true"
            Reminders-Enabled="true"
            DataReminderField="Reminder"
            StartEditingInAdvancedForm="true"
            OnFormCreated="RadScheduler1_FormCreated"
            AdvancedForm-EnableCustomAttributeEditing="true"
            OnAppointmentInsert="RadScheduler1_Scheduled_EventsInsert"
            OnAppointmentUpdate="RadScheduler1_Scheduled_EventsUpdate"
            CustomAttributeNames="Parameters"
            DataStartField="Start" DataSubjectField="Subject" Skin="Sitefinity">
            <Localization AdvancedEditAppointment="Edit Event" AdvancedNewAppointment="New Event" />
            <AppointmentContextMenuSettings EnableDefault="true" />
            <AdvancedForm Modal="true" />
            <AppointmentTemplate>
                    <%# Eval("Subject") %>
                    <p style="font-style: italic;">
                    <%# Eval("Parameters")%></p>
            </AppointmentTemplate>
            <TimelineView UserSelectable="false" />
            <ResourceTypes>
            <telerik:ResourceType ForeignKeyField="id"
                    KeyField="id" Name="Commands" TextField="CommandName" />
            </ResourceTypes>
            <ResourceStyles>
                 
            </ResourceStyles>
        </telerik:RadScheduler>
        <asp:SqlDataSource ID="SchedulerDataSource" runat="server"
            ConnectionString="<%$ ConnectionStrings:ConfigurationConnectionString %>"
            DeleteCommand="DELETE FROM [Scheduled_Events] WHERE [ID] = @ID"
            InsertCommand="INSERT INTO [Scheduled_Events] ([Subject], [Start], [End], [RecurrenceRule], [RecurrenceParentID], [Description], [Reminder], [Parameters], [CommandName]) VALUES (@Subject, @Start, @End, @RecurrenceRule, @RecurrenceParentID, @Description, @Reminder, @Parameters, @CommandName)"
            SelectCommand="SELECT [ID], [Subject], [Start], [End], [RecurrenceRule], [RecurrenceParentID], [Description], [Reminder], [Parameters] FROM [Scheduled_Events]"
             
            UpdateCommand="UPDATE [Scheduled_Events] SET [Subject] = @Subject, [Start] = @Start, [End] = @End, [RecurrenceRule] = @RecurrenceRule, [RecurrenceParentID] = @RecurrenceParentID, [Description] = @Description, [Reminder] = @Reminder, [Parameters] = @Parameters, [CommandName] = @CommandName WHERE [ID] = @ID">
            <DeleteParameters>
                <asp:Parameter Name="ID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="Subject" Type="String" />
                <asp:Parameter Name="Start" Type="DateTime" />
                <asp:Parameter Name="End" Type="DateTime" />
                <asp:Parameter Name="RecurrenceRule" Type="String" />
                <asp:Parameter Name="RecurrenceParentID" Type="Int32" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="Reminder" Type="String" />
                <asp:Parameter Name="Parameters" Type="String" />
                <asp:Parameter Name="ID" Type="Int32" />
                <asp:Parameter Name="CommandName" Type="String" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="Subject" Type="String" />
                <asp:Parameter Name="Start" Type="DateTime" />
                <asp:Parameter Name="End" Type="DateTime" />
                <asp:Parameter Name="RecurrenceRule" Type="String" />
                <asp:Parameter Name="RecurrenceParentID" Type="Int32" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="Reminder" Type="String" />
                <asp:Parameter Name="Parameters" Type="String" />
                <asp:Parameter Name="CommandName" Type="String" />
            </InsertParameters>



    I did attempt to use a custom attribute to try this as suggested in another thread, but was unable to get the RadComboBox successfully created dynamically.

    Any help would be greatly appreciated.

    Thanks,
    Justin
  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2062 posts

    Posted 22 Aug 2012 Link to this post

    Hello Justin,

    Unfortunately I am not able to reproduce the problem locally at my side, because there are some methods, which require implementation. Your data source for the combobox is also not provided. Let me list some web resources, that you could find helpful:
    •  Working with RadScheduler Resources - here
    • Code library, that adds RadCombobox functionality to the AdvancedEdit/Insert form - here
    • RadScheduler demo, that illustrates Resources defining and grouping in RadScheduler - here
    I hope this information is helpful.

    Kind regards,
    Boyan Dimitrov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Justin
    Justin avatar
    20 posts
    Member since:
    Jul 2011

    Posted 22 Aug 2012 Link to this post

    Understood. I will review the resources you provided and hopefully post a solution. Thanks.
  4. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2062 posts

    Posted 24 Aug 2012 Link to this post

    Hello Justin,

    You are very welcome and we are waiting for your post.


    Kind regards,
    Boyan Dimitrov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  5. Justin
    Justin avatar
    20 posts
    Member since:
    Jul 2011

    Posted 31 Aug 2012 Link to this post

    Boyan,

    Thanks again for your help. While I was never able to solve entirely what was causing my original error I was able to come up with another solution. By using the example you provided on how to dynamically add the radComboBox to the page, I was able to add the control and set its value in the DB. Works like a charm.

    Thanks for your help.

    -Justin
  6. Daniel
    Daniel avatar
    34 posts
    Member since:
    Feb 2011

    Posted 16 Dec 2012 Link to this post

    Hi

    I am having a similar issue.

    My implementation allows only for update of existing appointments.  New appointments are created from a drag N drop fro a rad grid of pending tasks.  I have followed you many samples on this and it is all working fine.

    I am implementing the advance form to allow an easier change of a task for dates further out.  The form of course popluates properly (at least renders properly) with the expected data.  I do override the OnFormCreate to hide a few things and "fully" populate the resources as otherwise only the "selected" resources are available.    Here is this code

     
    protected override void OnFormCreated(Appointment appointment, SchedulerFormContainer container)
            {
                base.OnFormCreated(appointment, container);
     
                if (AddResourcesToAdvanceForm)
                {
                    RadComboBox ResTechs = (RadComboBox)container.FindControl("ResTechs");
                    if (ResTechs != null)
                    {
                        ResTechs.Items.Clear();
     
                        ResTechs = DropDownUtils.SetDropDown(ResTechs, DropDownUtils.DropDownListType.MyWorkers, Labeling.Unassigned);
                        ResTechs.SelectedValue = appointment.Resources[0].Key.ToString();
                    }
                }
     
                if (container.Mode == Telerik.Web.UI.SchedulerFormMode.AdvancedEdit)
                {
                    RadDatePicker startTime = (RadDatePicker)container.FindControl("StartTime");
                    if (startTime != null)
                        startTime.MinDate = DateTime.Today;
     
                    RadDatePicker endTime = (RadDatePicker)container.FindControl("EndTime");
                    if (endTime != null)
                        endTime.MinDate = DateTime.Today;
     
     
                    RadTextBox Subject = (RadTextBox)container.FindControl("Subject");
                    if (Subject != null)
                    {
                        Subject.Enabled = false;
                        Subject.ForeColor = System.Drawing.Color.Black;
                    }
     
                    if (container.FindControl("RecurrenceEditor") != null)
                        container.FindControl("RecurrenceEditor").Visible = false;
     
                    if (container.FindControl("AdvancedEditCloseButton") != null)
                        container.FindControl("AdvancedEditCloseButton").Visible = false;
                }
            }

    Even if I make no changes to the update, when we save, the "Base-64 string" error is thrown.  It is not making it to the OnApppointmentUpdate Event.  here is my log...

    --- START ERROR: 16/12/2012 17:04:54 ------
    System.FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. 
       at System.Convert.FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength)
       at System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength)
       at System.Convert.FromBase64String(String s)
       at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString, Purpose purpose)
       at System.Web.UI.LosFormatter.Deserialize(String input)
       at Telerik.Web.UI.LosSerializer.Deserialize(String serializedObject, Boolean enableMacValidation)
       at Telerik.Web.UI.LosSerializer.Deserialize(String serializedObject)
       at Telerik.Web.UI.AdvancedTemplate.ExtractResourceValues(IDictionary target)
       at Telerik.Web.UI.AdvancedTemplate.ExtractValues(Control container)
       at Telerik.Web.UI.RadScheduler.UpdateAppointmentInline(Boolean removeExceptions)
       at Telerik.Web.UI.RadScheduler.OnBubbleEvent(Object source, EventArgs args)
       at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
       at System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
       at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
     --- END ERROR ------------------

    I am noticing that the after extracting the resource values, we eventually decode.  My resources are populated from a DB and we use UniqueIdentifiers (Guid in code) as our primary key.  I tried casting the guid to a string when creating the resources, but this seems to cause the resource to not create at all (Key is an object, not a string, perhaps the cause).

    Here is how I am currently creating the resources.  Inside a foreach loop of my list of techs (object)

    Resource resource = new Resource();
    resource.Key = tech.UserId;
    resource.Text = tech.FullName;
    resource.Type = "Techs";
    resource.CssClass = styles[x];
    workerSchedule.Resources.Add(resource);


    Could the Guid as Key be the source of my pain?  If so, any direction?  If not, any other thoughts?  As you can see, I have really tried to fish this on my own, but am in territory that I am a bit unfamiliar with.  It has worked fine in all my other areas, succesfully creating appointment and modifying them on drag and drop in the actual scheduler.  It is only the advance form that seem to complain.

    Thanks



  7. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2062 posts

    Posted 20 Dec 2012 Link to this post

    Hello Daniel,

    We are not aware of such error message by updating an existing appointment. I have tested the provided code and I am unable to reproduce that issue locally. The error message that you are facing shows that your string is not encoded in Base64. It's pretty easy to recognize a Base64 string, as it will only be composed of characters 'A'..'Z', 'a'..'z', '0'..'9', '+', '/' and it is often padded at the end with up to three '='. Your string obviously doesn't qualify and this is why you get the exception. 


    Kind regards,
    Boyan Dimitrov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  8. Daniel
    Daniel avatar
    34 posts
    Member since:
    Feb 2011

    Posted 09 Jan 2013 Link to this post

    HI Boyen

    Thanks for the reply, and sorry for the delayed response on my behalf.  With the holidays, I am only now circling back to this.   Happy new years to you!!!

    I am still struggling with this.  I have made progress but also note some other issues..

    First, with regards to the Base64 encoding.  This is not anything I am doing, I assume it is something happening in the Advance template control.  This is were I have made some progress in that I have identified the offensive code, but not the cause.

    The issue is in the OnFormCreated override... as you can see below, I am locaging the resouce radCombo and repopulating it.  I do this because by default, it will only populate the resources based on the current schedule view.  We provide filtered views, and they may need to assigned to a resource not in the list due to this.  This is the issue.  Removing this code removes the error.  As a reminder, the appointment key is a GUID.  We have always used GUIDS as our PKs, and the radCombo has never has an issue, which leads me to believe it is the template and the way it encodes/decodes the key (see code below)

     protected override void OnFormCreated(Appointment appointment, SchedulerFormContainer container)
            {
                base.OnFormCreated(appointment, container);
     
                if (AddResourcesToAdvanceForm)
                {
                    RadComboBox ResTechs = (RadComboBox)container.FindControl("ResTechs");
                    if (ResTechs != null)
                    {
                        ResTechs.Items.Clear();
     
                        ResTechs = DropDownUtils.SetDropDown(ResTechs, DropDownUtils.DropDownListType.MyWorkers, Labeling.Unassigned);
                        ResTechs.SelectedValue = appointment.Resources[0].Key.ToString();
                    }
                }
    



    Additionally, I am seeing two other issues.

    1) Also in the OnFormCreated  we are locating the Start and end RadDateTime Picker 
    and setting them to DateTime.Now (end = Now + original appoiintment duration) as we
    do not wish to allow scheduling in the past (a great suggestion as a native config
    attribute for the scheduler).

    RadDateTimePicker startTime = (RadDateTimePicker)container.FindControl("StartTime");
    if (startTime != null)
    	startTime.SelectedDate = DateTimeFunctions.DisplayAdjustUtcOffset(DateTime.UtcNow);
     
     
    RadDateTimePicker endTime = (RadDateTimePicker)container.FindControl("EndTime");
    if (endTime != null)
    	endTime.SelectedDate = DateTimeFunctions.DisplayAdjustUtcOffset(DateTime.UtcNow).Add(appointment.Duration);





    In this issue, the Time portion is set properly, but the date remains the original date of the appointment.

    2)  Once I make all the changes and save, the Advance Template window closes, but the schedule, or appointment
    is not updated in the schedule.  It remains in the original time slot.  In the AppointmentUpdate method, I can
    see the changes in the e.modifiedAppointment.  Also, dragging an appointment to another slot works properly.

    Thanks in advance for any direction on these items
  9. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2062 posts

    Posted 14 Jan 2013 Link to this post

    Hello,

    We are not aware of such issue with RadComboBox control and GUID type used for Primary key.
    Regarding your second issue: I would recommend you to access the RadDatePicker as well, in order to change the date based on some additional calculations. Modifying the StartTime RadDatePicker will change just the selected time.

    //code behind
    RadDatePicker startTime = (RadDatePicker)e.Container.FindControl("StartDate");
    DateTime start = (DateTime)startTime.SelectedDate;
    start = start.AddDays(2);
    startTime.SelectedDate = start;

    The code above will add additional 2 days to your start time date picker.

    Please could you check for any JavaScript errors while updating an appointment using the AdvancedForm?


    Regards,
    Boyan Dimitrov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  10. Daniel
    Daniel avatar
    34 posts
    Member since:
    Feb 2011

    Posted 17 Jan 2013 Link to this post

    Hi again

    I am still stuck

    First, I think I miss explained myself.  We use Guid with the radComboBox without issue often.  It appears only to be an issue when deleting the items, then adding items back in to the Resource radComboBox within the OnFormCreate override of the radScheduler.  I am not sure it is the GUID... simply put, this process errors with the  at System.Convert.FromBase64_Decode error.

    2) still having issues with changing the date & minDate of the start and end appointment dates in the advanced form

    As you suggested, I have located both the RadDatePicker & RadDateTimePicker for both, again in the OnFormCreated override.  I can see these both being properly set to the current UtcNow (I wrap in a method that adjusts to the users known timezone), but the date & time is correct with stepping through, but renders with the original date time of the appointment.  Once again, here is my latest code

    if (container.Mode == Telerik.Web.UI.SchedulerFormMode.AdvancedEdit)
    {
    	RadDateTimePicker startTime = (RadDateTimePicker)container.FindControl("StartTime");
            if (startTime != null)
            	startTime.SelectedDate = DateTimeFunctions.DisplayAdjustUtcOffset(DateTime.UtcNow);
     
    	RadDatePicker startTime1 = (RadDatePicker)container.FindControl("StartTime");
            if (startTime1 != null)
            {
    		startTime1.SelectedDate = DateTimeFunctions.DisplayAdjustUtcOffset(DateTime.UtcNow);
                    startTime1.MinDate = DateTimeFunctions.DisplayAdjustUtcOffset(DateTime.UtcNow);
            }
     
            RadDateTimePicker endTime = (RadDateTimePicker)container.FindControl("EndTime");
            if (endTime != null)
                 endTime.SelectedDate = 
    		DateTimeFunctions.DisplayAdjustUtcOffset(DateTime.UtcNow).Add(appointment.Duration);
     
            RadDatePicker endTime1 = (RadDatePicker)container.FindControl("EndTime");
            if (endTime1 != null)
            {
             	endTime1.SelectedDate = 
    		   DateTimeFunctions.DisplayAdjustUtcOffset(DateTime.UtcNow).Add(appointment.Duration);
                    endTime1.MinDate = 
    		    DateTimeFunctions.DisplayAdjustUtcOffset(DateTime.UtcNow).Add(appointment.Duration);
             }


    All the other updates to controls (mainly setting visible to false) take fine.

    Thanks again for any direction in advance
  11. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2062 posts

    Posted 22 Jan 2013 Link to this post

    Hello,

    Regarding your first issue - I have tested your scenario, but I was unable to reproduce the issue at my side. Therefore I prepared a sample project following your instructions.
    About your second issue - in order to access and modify the start date, which is completely different from the DateTimePicker showing only the hour and minutes, you can use the following code snippet:
    //code behind
    protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
        {
     
            if (e.Container.Mode == SchedulerFormMode.AdvancedEdit)
            {
                RadComboBox rooms = e.Container.FindControl("ResTeacher") as RadComboBox;
                rooms.Items.Clear();
                rooms.Items.Add(new RadComboBoxItem("Item 1"));
                rooms.Items.Add(new RadComboBoxItem("Item 2"));
     
                 
                RadDatePicker startDate = (RadDatePicker)e.Container.FindControl("StartDate");
                startDate.SelectedDate = new DateTime(2010, 11, 22);
                 
            }
        }


    Regards,
    Boyan Dimitrov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  12. Daniel
    Daniel avatar
    34 posts
    Member since:
    Feb 2011

    Posted 22 Jan 2013 Link to this post

    Hi Boyan

    thanks for the reply

    I looked at the sample provided related to the radcomobox.  I note a few differences and as we know, even a subtle difference can cause an issue.

    1) you are not adding a Guid as the Value of the radComboBoxItem.  I believe this is where the issue is.  Please try this on your end
    RadComboBox rooms = e.Container.FindControl("ResTeacher"as RadComboBox;
                rooms.Items.Clear();
                rooms.Items.Add(new RadComboBoxItem("Item 1", Guid.NewGuid().ToString()));
                rooms.Items.Add(new RadComboBoxItem("Item 2", Guid.NewGuid().ToString()));



    2) again, very subtle, but you are setting this in the code behind of the page adding a FormCreated event handler.  I am doing an override of OnFormCreated in a class inheriting RadScheduler.  Admittedly a very small nuance, but if we are getting different results for the same test, differences and nuances need to be eliminated before you can say my issue is not reproducible.  I think this is less the issue and number 1 above is where you will reproduce my issue.


    Also

    I am not sure how the RadDatePicker code is different.  I am locating both the DatePicker AND the DateTimePicker.  The time is setting properly, the date is not.  

    For all of this I substituted my code for the code you sent me. moving it into the page itself, and I still do not get the expected results.


    Thanks again
  13. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2062 posts

    Posted 25 Jan 2013 Link to this post

    Hello,

    I would like to clarify that we recommend using the RadScheduler OnFormCreated server-side event. Overriding our RadScheduler events could cause unusual behavior that is not directly related to the control functionality.

    Regarding your first issue, I have added the code snippet for adding dynamically items that has Guid values and still I am not reproducing that issue. Please review  this video here where is shown the application behavior at my side after applying that custom logic.

    Regarding your second issue - to avoid any further misunderstandings I prepared a sample code snippet that illustrates how you can set the correct values for both start date and start time in your advanced form:
    //code behind 
    if (e.Container.Mode == SchedulerFormMode.AdvancedEdit)
            {
               ..........
                RadDatePicker startDate = (RadDatePicker)e.Container.FindControl("StartDate");          
                RadDateTimePicker startTime = (RadDateTimePicker)e.Container.FindControl("StartTime");
                DateTime initialTime = startTime.SelectedDate.Value;
                startTime.SelectedDate = startTime.SelectedDate.Value.AddHours(10);
                if (true)// here goes your custom logic to compare initialTime and new start time after applying 10 hours.
                        // if date picker needs to jump to next day, explicitly add one day to current date
                {
                   startDate.SelectedDate = startDate.SelectedDate.Value.AddDays(1);
                }
     
            }

    Regards,
    Boyan Dimitrov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  14. Daniel
    Daniel avatar
    34 posts
    Member since:
    Feb 2011

    Posted 25 Jan 2013 Link to this post

    So...

    1/2 way there... the good news first ... I missed switching the name from StarTime to StartDate... I thought I really "STARED" at your snippet the last time, but it definitely (embarrassingly) jumped out at me this time...   So that is not working properly.

    re: the RadComboBox...

    I did watch your video, It was difficult to tell, however, I do not think you actually saved the appointment.  I too have the radComboBox loading populating & rendering properly.  The error is thrown on Save of the appointment

    As far as overriding... that seems very curious to me.  We are creating a class that we inherit from yours, so that we can set these default behaviors for all the schedulers in one location.  We have been doing this for years with your controls...

    That said, I moved the code into the OnPageCreate of a page and still see the same issue, so, it is, if nothing else, consistent in it's behavior.

    Please confirm for me that you can in fact SAVE the appointment.  

    Thanks again... 
  15. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2062 posts

    Posted 30 Jan 2013 Link to this post

    Hello,

    It seems that adding/modifying resource items OnFormCreated server-side event is causing unexpected behavior. Therefore I would recommend using custom attributes instead of resources to implement the desired functionality.
    You may find our KB resource located here demonstrating an approach that uses custom attributes as RadComboBoxes controls that look and feel like resources. 
    Additionally I would recommend to use our code library resource containing the advanced form as separate user control. This way you can use it and easily implement the approach from the KB resource.

    Regards,
    Boyan Dimitrov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top