This is a migrated thread and some comments may be shown as answers.

Can we declare both ResourceTypes & AdvancedEditTemplate in RadGrid Control ?

8 Answers 98 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Stephane
Top achievements
Rank 1
Stephane asked on 11 Mar 2011, 04:00 PM
Hello,

I need to know if a RadGrid control can integrate ResourceTypes & AdvancedEditTemplate sections. In my case, RessourceTypes are never displayed. Is it normal ?

Thanks,

Steph

8 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 11 Mar 2011, 04:17 PM
Hello Stephane,

Is your question concerned about the RadGrid or RadScheduler? If you mean RadScheduler - please take a look at the "Using Templates" Demo for RadScheduler.

Best wishes,
Veronica Milcheva
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Stephane
Top achievements
Rank 1
answered on 11 Mar 2011, 04:40 PM
Hello Veronica,

I'm talking about RadScheduler. The following statement doesn't appear the RessourceTypes. If the AppointmentTemplate,AdvancedEditTemplate and  AdvancedInsertTemplate are in comment, the RessourcesTypes are correctly displayed. Any idea ?

<telerik:RadScheduler runat="server" ID="RadScheduler1" Width="100%" OnDataBound="RadScheduler1_DataBound"
            DataSourceID="oOdsJourCalendrier" AppointmentStyleMode="Default" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound"
            OnClientFormCreated="schedulerFormCreated" EnableDescriptionField="True" OnAppointmentInsert="RadScheduler1_AppointmentInsert"
            OnAppointmentUpdate="RadScheduler1_AppointmentUpdate" DataEndField="Fin" DataKeyField="Id"
            DataStartField="Debut" DataSubjectField="Poste.Code" StartInsertingInAdvancedForm="True"
            Culture="fr-FR" FirstDayOfWeek="Monday" LastDayOfWeek="Sunday" AdvancedForm-Modal="True"
            CustomAttributeNames="Position" Skin="Sunset" GroupingDirection="Vertical" WorkDayStartTime="00:00:00"
            WorkDayEndTime="23:59:59">
            <AdvancedForm Modal="true" />
            <ResourceTypes>
                <telerik:ResourceType DataSourceID="oOdsService" ForeignKeyField="Service.Id" KeyField="Id"
                    Name="Service" TextField="Libelle" />
                <telerik:ResourceType DataSourceID="oOdsCollaborateur" ForeignKeyField="Collaborateur.Id"
                    KeyField="IdCollaborateur" Name="Collaborateur" TextField="Nom" />
            </ResourceTypes>
            <AppointmentTemplate>
                <div class="rsAptSubject">
                    <%# Eval("Subject") %>
                </div>
                <%# Eval("Description") %>
            </AppointmentTemplate>
            <AdvancedEditTemplate>
                <scheduler:AdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit" Subject='<%# Bind("Subject") %>'
                    Description='<%# Bind("Description") %>' Start='<%# Bind("Start") %>' End='<%# Bind("End") %>'
                    RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' Position='<%# Bind("Position") %>' />
            </AdvancedEditTemplate>
            <AdvancedInsertTemplate>
                <scheduler:AdvancedForm runat="server" ID="AdvancedInsertForm1" Mode="Insert" Subject='<%# Bind("Subject") %>'
                    Start='<%# Bind("Start") %>' End='<%# Bind("End") %>' Description='<%# Bind("Description") %>'
                    RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' Position='<%# Bind("Position") %>' />
            </AdvancedInsertTemplate>
            <TimelineView UserSelectable="false" />
            <TimeSlotContextMenuSettings EnableDefault="true" />
            <AppointmentContextMenuSettings EnableDefault="true" />
        </telerik:RadScheduler>
        <asp:ObjectDataSource ID="oOdsCollaborateur" runat="server" OldValuesParameterFormatString="original_{0}"
            SelectMethod="rechercher" TypeName="MedGicNet.SRV.CollaborateursCRUD" DataObjectTypeName="MedGicNet.BLL.Collaborateurs"
            DeleteMethod="supprimer" InsertMethod="inserer" UpdateMethod="actualiser">
            <SelectParameters>
                <asp:SessionParameter Name="cConnexion" SessionField="SERVEURSQL" Type="String" />
            </SelectParameters>
        </asp:ObjectDataSource>
        <asp:ObjectDataSource ID="oOdsService" runat="server" OldValuesParameterFormatString="original_{0}"
            SelectMethod="Select_All" TypeName="MedGicNet.BLL.ServiceManager"></asp:ObjectDataSource>
        <asp:ObjectDataSource ID="oOdsJourCalendrier" runat="server" DataObjectTypeName="MedGicNet.DTO.JourCalendrierEntity"
            DeleteMethod="Delete" InsertMethod="Insert" OldValuesParameterFormatString="original_{0}"
            SelectMethod="Select_All" TypeName="MedGicNet.BLL.JourCalendrierManager" UpdateMethod="Update">
        </asp:ObjectDataSource>
0
Veronica
Telerik team
answered on 11 Mar 2011, 04:57 PM
Hi Stephane,

To be able to appear the ResourceTypes in the customized Advanced Form you need to set a Bindable property to the code-behind of your advanced form
 
[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
        public object RoomID
        {
            get
            {
                return ResRoom.Value;
            }
  
            set
            {
                ResRoom.Value = value;
            }
        }

and bind it in the AdvacedInsertTemplate/ AdvancedEditTemplate via Eval expression:

<AdvancedEditTemplate>
                <scheduler:AdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit"
                    Subject='<%# Bind("Subject") %>'
                    Description='<%# Bind("Description") %>' 
                    Start='<%# Bind("Start") %>'
                    End='<%# Bind("End") %>'
                    RecurrenceRuleText='<%# Bind("RecurrenceRule") %>'
                       Reminder='<%# Bind("Reminder") %>'
                    AppointmentColor='<%# Bind("AppointmentColor") %>' 
                    UserID='<%# Bind("User") %>'
                    RoomID='<%# Bind("Room") %>' />
            </AdvancedEditTemplate>

Please take a look at the "Advanced Templates" demo for the full code.

Greetings,
Veronica Milcheva
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Stephane
Top achievements
Rank 1
answered on 11 Mar 2011, 05:12 PM
Hello Veronica,

So, all the stuff is done in the AdvancedxxxTemplate section. In your first example, it seems that we can combine ResourceTypes & AdvancedEditTemplate sections. So, the right question is : Can we declare both ResourceTypes & AdvancedEditTemplate/AdvancedInsertTemplate in RadGrid Control to be displayed in a customized Advanced Form ?

Thanks for the clarification.

Regards,

Stéphane

<telerik:RadScheduler runat="server" ID="RadScheduler1" SelectedDate="2007-03-30"
        DayStartTime="08:00:00" DayEndTime="18:00:00" ShowViewTabs="false" StartEditingInAdvancedForm="false"
        DataSourceID="AppointmentsDataSource" DataKeyField="ID" DataSubjectField="Subject"
        DataStartField="Start" DataEndField="End" DataRecurrenceField="RecurrenceRule"
        DataRecurrenceParentKeyField="RecurrenceParentID" OnAppointmentCommand="RadScheduler1_AppointmentCommand"
        OnFormCreated="RadScheduler1_FormCreated" OnFormCreating="RadScheduler1_FormCreating"
        OnAppointmentCreated="RadScheduler1_AppointmentCreated">
        <ResourceTypes>
            <telerik:ResourceType KeyField="ID" Name="AppointmentType" TextField="Keyword" ForeignKeyField="AppointmentTypeID"
                DataSourceID="AppointmentTypesDataSource" />
        </ResourceTypes>
        <ResourceStyles>
            <telerik:ResourceStyleMapping Type="AppointmentType" Text="technical" ApplyCssClass="rsCategoryGreen" />
            <telerik:ResourceStyleMapping Type="AppointmentType" Text="specification_review"
                ApplyCssClass="rsCategoryOrange" />
            <telerik:ResourceStyleMapping Type="AppointmentType" Text="code_review" ApplyCssClass="rsCategoryBlue" />
        </ResourceStyles>
...
<AppointmentTemplate>
            <div class="rsCustomAppointmentContainer <%# Eval("AppointmentType.Text") %>">
                <h2>
                    <%# Eval("Subject") %>
                </h2>
                <div>
                </div>
            </div>
        </AppointmentTemplate>
0
Veronica
Telerik team
answered on 11 Mar 2011, 05:23 PM
Hi Stephane,

The two demos that I referred you in my previous posts are describing different approaches.

1) The "Using Templates" demo describes full customization of the inline and advanced forms.

2) The "Advanced Templates" demo shows how you can add additional fields to the default advanced form.

At first I thought that your issue is similar to the first demo. However after I saw your code snippet - I assumed that you are trying to customize the Advanced Form. That's why the advice that I gave you in my last post describes what you need to display Resources in the Advanced Form.

Could you please tell me whether I am missing something in your requirement?

All the best,
Veronica Milcheva
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Stephane
Top achievements
Rank 1
answered on 11 Mar 2011, 05:51 PM
Hi Veronica,

In fact, I need to add fields to the default advanced form. But, I started to work with the following example (http://www.telerik.com/support/kb/aspnet-ajax/scheduler/implement-related-radcombobox-controls-in-the-advanced-form.aspx). The RadComboBox is explicitly declared in the 'Resource controls' section of the AdvancedForm.ascx associated with his datasource. This solution uses method based on custom attributes.

I've just implemented the solution like you suggested and all seems good. But I'm a little bit lost. What are the difference betweem these two approaches ? What is the best practise to do ?

Thanks for your explanation.

Regards,

Steph

<telerik:RadScheduler runat="server" ID="RadScheduler1" Width="100%" OnDataBound="RadScheduler1_DataBound"
            DataSourceID="oOdsJourCalendrier" AppointmentStyleMode="Default" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound"
            OnClientFormCreated="schedulerFormCreated" EnableDescriptionField="True" OnAppointmentInsert="RadScheduler1_AppointmentInsert"
            OnAppointmentUpdate="RadScheduler1_AppointmentUpdate" DataEndField="Fin" DataKeyField="Id"
            DataStartField="Debut" DataSubjectField="Poste.Code" StartInsertingInAdvancedForm="True"
            Culture="fr-FR" FirstDayOfWeek="Monday" LastDayOfWeek="Sunday" AdvancedForm-Modal="True"
            CustomAttributeNames="Position" Skin="Sunset" GroupingDirection="Vertical" WorkDayStartTime="00:00:00"
            WorkDayEndTime="23:59:59">
            <AdvancedForm Modal="true" />
            <ResourceTypes>
                <telerik:ResourceType DataSourceID="oOdsPoste" ForeignKeyField="Id" KeyField="Id"
                    Name="Position" TextField="Code" />
                <telerik:ResourceType DataSourceID="oOdsService" ForeignKeyField="Service.Id" KeyField="Id"
                    Name="Service" TextField="Libelle" />
                <telerik:ResourceType DataSourceID="oOdsCollaborateur" ForeignKeyField="Collaborateur.Id"
                    KeyField="IdCollaborateur" Name="Collaborateur" TextField="Nom" />
            </ResourceTypes>
            <AppointmentTemplate>
                <div class="rsAptSubject">
                    <%# Eval("Position") %>
                </div>
                <%# Eval("Description") %>
            </AppointmentTemplate>
            <AdvancedEditTemplate>
                <scheduler:AdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit" Subject='<%# Bind("Subject") %>'
                    Description='<%# Bind("Description") %>' Start='<%# Bind("Start") %>' End='<%# Bind("End") %>'
                    RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' Position='<%# Bind("Position") %>' />
            </AdvancedEditTemplate>
            <AdvancedInsertTemplate>
                <scheduler:AdvancedForm runat="server" ID="AdvancedInsertForm1" Mode="Insert" Subject='<%# Bind("Subject") %>'
                    Start='<%# Bind("Start") %>' End='<%# Bind("End") %>' Description='<%# Bind("Description") %>'
                    RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' Position='<%# Bind("Position") %>' />
            </AdvancedInsertTemplate>
0
Veronica
Telerik team
answered on 12 Mar 2011, 10:14 AM
Hello Stephane,

I'm glad that you've been able to solve your issue. In my previous post I gave you a short explanation of the differences between the two apparoaches. Here's more:

1) Using Templates - you can customize the appearance of all forms (Inline and Advanced) by implementing templates. Usually you can do it when you don't want the basic UI and functionality of the forms.

2) Customizing the Advanced Form Template - common problem when using the AdvancedInsertTemplate or the AdvancedEditTemplate is that the functionality related to recurrence and resources is lost. In other words, if you chose to customize the advanced form you will not be able to insert or edit recurring appointments or appointments with resources, unless you implement this functionality from scratch.

Regards,
Veronica Milcheva
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Stephane
Top achievements
Rank 1
answered on 14 Mar 2011, 10:26 AM
Hello Veronica,

I submit a support ticket (threadId=402566). If you can join us, It would be nice.

Thanks for your support.

Regards,

Stéphane
Tags
Scheduler
Asked by
Stephane
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Stephane
Top achievements
Rank 1
Share this question
or