Custom attribute values are not correct when editing the series of a recurring event

14 posts, 0 answers
  1. Ed
    Ed avatar
    15 posts
    Member since:
    Apr 2009

    Posted 06 May 2011 Link to this post

    I am using the advanced template for inserting and editing an appointment.  I have created all my custom attributes where some the fields are populated from the appointment record and the others are populated only when inserting/editing an appointment such as default point of contact information.

    Everything works correctly except for one condition when I edit the series of an existing recurring appointment.  All other cases (create a new appointment, edit a non-recurring appointment and edit a single occurrence of a recurring appointment) function as expected.  The problem I am having is that when I choose to edit series of an appointment, all my custom attributes that are not part of the appointment during the AppointmentDataBound event are blank.  I have verified through the debugger that they are getting set in the OnFormCreating event just like in all the other scheduler appointment edit conditions.  Also, when I look at the value being passed to the custom attribute property of the advanced form, it is blank.

    Now, what is also very perplexing is that I can get it to work under a unique circumstance.  For example, if I am in month view and I click on the appointment of the very first day of the recurring event and choose to edit the series, my expected data for the custom attributes are set correctly.  Then when I click on any of the other days in which that recurring event is happening, the custom attributes are still correct.  But when I refresh the page and click on any of the recurring event days other than the very first one, it will not work and my custom attributes are blank.  But, then, click on the very first day and all the custom attributes will be correct again.

    Ed Lamprecht
  2. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 11 May 2011 Link to this post

    Hi Ed,

    I tried to reproduce the issue that you got on our demos but to no avail. Could you please send me a sample project or the steps to reproduce it on one of our demos?

    Thank you!

    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. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ed
    Ed avatar
    15 posts
    Member since:
    Apr 2009

    Posted 11 May 2011 Link to this post

    Veronica Milcheva,


    I've taken the scheduler's advanced templates demo and modified it to produce the issue I am having.  The following changes were made:
       1) Changed the appointment data xml file so that one of the meetings is now a daily recurring appointment.
       2) On the advanced form, added a simple text box for "DefUserName" and corresponding binding property for it.
       3) On the defaultcs.aspx, added a custom attribute name for DefUserName and added a RadScheduler FormCreating event to set it.

    For me, this exhibits the problem I first described and that is when I edit the series of a recurring event that is NOT the very first one, then DefUserName is blank.  Every other operation (insert a new event, edit the single occurrence of any recurring event, edit a non-recurring event), DefUserName contains the string "John Doe".

    Appointments_CustomTemplates.xml:
    <Appointment>
        <ID>1</ID>
        <Subject>Daily Meeting</Subject>
        <Start>2007-03-30T06:00Z</Start>
        <End>2007-03-30T08:00Z</End>
        <RecurrenceRule>
            <![CDATA[
            DTSTART:20070330T060000Z
            DTEND:20070330T080000Z
            RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20070406T210000Z;BYDAY=MO,TU,WE,TH,FR;
            ]]>
        </RecurrenceRule>
        <Resources>
            <User Key="2" />
            <User Key="3" />
            <Room Key="1" />
        </Resources>
        <Attribute Key="Description" Value="With customers." />
    </Appointment>

    AdvancedFormCS.ascx added just preceding the description text box:
    <telerik:RadTextBox runat="server" ID="tbDefUserName" TextMode="SingleLine" Width="200px" Label="DefUserName" />

    AdvancedFormCS.ascx.cs:
    [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
    public string DefUserName
    {
        get { return tbDefUserName.Text; }
        set { tbDefUserName.Text = value; }
    }

    DefaultCS.aspx:
    <telerik:RadScheduler runat="server" ID="RadScheduler1" Width="750px"
        ...
        OnFormCreating="RadScheduler1_FormCreating"
        ...
        CustomAttributeNames="AppointmentColor, DefUserName"
        ...
        <AdvancedEditTemplate>
            <scheduler:AdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit"
            ...
            RoomID='<%# Bind("Room") %>'
            DefUserName='<%# Bind("DefUserName") %>'
        />
        </AdvancedEditTemplate>
        <AdvancedInsertTemplate>
            <scheduler:AdvancedForm runat="server" ID="AdvancedInsertForm1" Mode="Insert"
            ...
            RoomID='<%# Bind("Room") %>'
            DefUserName='<%# Bind("DefUserName") %>'
        />
        ...
    </telerik:RadScheduler>

    DefaultCS.aaspx.cs:
    protected void RadScheduler1_FormCreating(object sender, SchedulerFormCreatingEventArgs e)
    {
        e.Appointment.Attributes.Add("DefUserName", "John Doe");
    }


    Ed Lamprecht

  5. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 17 May 2011 Link to this post

    Hello Ed,

    Thank you for the detailed description and the code provided.

    I've prepared a sample project to test your scenario. However I tried to reproduce the issue but to no avail. The custom attribute shows "John Doe" even if I edit the series of a recurring appointment that is not the master. Please take a look at my project and let me know if you reproduce the issue on your side. If yes - could you please provide me the steps so I can inspect it and help you?

    Thank you!


    Best wishes,
    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.

  6. Ed
    Ed avatar
    15 posts
    Member since:
    Apr 2009

    Posted 20 May 2011 Link to this post

    As I was having difficulty getting your code to run, I compared you zip data with mine and found that the xml data has an extra value: <attribute Key="DefUserName" Value="John Doe"> in the appointment.  I do not have this in my data.

    Based on this, the only change I made to my test sample is to add the attribute.  At first check, it appeared to work but  then I changed the xml attribute key to use the value of "Richard Stiles".  The code executing during the OnFormCreating event is still the same - it sets the attribute of "DefUserName" to "John Doe".  Now, I get the same problem as before (just not blank).  When I edit the series of a recurring event that is not the first day of recurring event, I get "Richard Stiles" and not "John Doe".

    Also, my application scenario is such that the attributes I am adding are not part of the appointment details but are added at the time a user inserts/edits an appointment.  Still, the results are the same.

    Ed Lamprecht
  7. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 24 May 2011 Link to this post

    Hi Ed,

    Can you also make sure that you set CustomAttributeNames="DefUserName" for RadScheduler. Does this help?

    Kind 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.

  8. Ed
    Ed avatar
    15 posts
    Member since:
    Apr 2009

    Posted 24 May 2011 Link to this post

    Already had CustomAttributeNames set to include DefUserName.  The sample code I started with already had AppointmentColor being set and I added DefUserName to this list.  You can see it in my code snippet that I previously posted.

    Ed
  9. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 31 May 2011 Link to this post

    Hi Ed,

    Could you please attach a .zip file with your full code so I can inspect it and help you? As this is a forum post - you are not allowed to attach .zip files. As an alternative please use one of the sites for free online storage like 4shared.com.

    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. Ed
    Ed avatar
    15 posts
    Member since:
    Apr 2009

    Posted 31 May 2011 Link to this post

    Veronica Milcheva,

    Please access a zip file using this link: https://www.knowledgenow.net/DMS/ViewDoc.aspx?DocID=10145

    Ed Lamprecht
  11. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 03 Jun 2011 Link to this post

    Hello Ed,

    Thank you for the attached project.

    The problem lies in the fact that you are re-adding the custom attribute "DefUserName" in the OnFormCreating event instead of just changing it's value. Here's the solution:

    protected void RadScheduler1_FormCreating(object sender, SchedulerFormCreatingEventArgs e)
           {
               e.Appointment.Attributes["DefUserName"] = "John Doe";
           }

    Please let me know if this was helpful.

    Kind 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.

  12. Ed
    Ed avatar
    15 posts
    Member since:
    Apr 2009

    Posted 03 Jun 2011 Link to this post

    Veronica Milcheva,

    I did just that single line change to the sample code and it, unfortunately, made no difference.

    If you are using the sample xml data that was included in the zip file, there is a daily recurring event called "Daily Meeting" starting on 3/30/2007.  If you navigate the scheduler to 4/5/2007, double click on "Daily Meeting" and select "Edit the series" from the popup, you will get the DefUserName set to "John Stiles" which is the value in the xml data and not what is being set in code on the FormCreating event.  The attached image labeled "4-5-07 Edit Appointment Form.jpg" shows my result.

    Now, navigate to 3/30/2007, do the same thing and you will get the DefUserName set to "John Doe".  The attached image labeled "3-30-07 Edit Appointment Form.jpg" shows this.

    Ed Lamprecht
  13. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 13 Jun 2011 Link to this post

    Hi Ed,

    You need to access the RadTextBox control in the OnFormCreated event and set the text property to prepopulate it. Here's the code for this:

    protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
           {
               if ((e.Container.Mode == SchedulerFormMode.AdvancedEdit) || (e.Container.Mode == SchedulerFormMode.AdvancedInsert))
               {
                   RadTextBox attrTextBox = e.Container.Controls[1].FindControl("tbDefUserName") as RadTextBox;
                   attrTextBox.Text = "John Doe";
               }
           }

    Please let me know if this was helpful.

    Best wishes,
    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.

  14. Ed
    Ed avatar
    15 posts
    Member since:
    Apr 2009

    Posted 17 Jun 2011 Link to this post

    Veronica,

    This does get me around my problem.  Although it works, it seems a bit awkward in that it requires one page to know the control type and its ID in another form to set its value.  If edit dialog's view should change from a text box to something else, you must also change the scheduler referencing whereas just passing the data would not require a change.  Even more peculiar is that this method is needed to correct what works in all other instances of editing or creating an event.

    Thanks for your assistance.
    Ed Lamprecht
  15. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 22 Jun 2011 Link to this post

    Hi Ed,

    Although is seems "awkward" this is the proved way to prepopulate the fields of the advanced form.

    Please let me know if you need further help.

    Best wishes,
    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.

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017