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

Hidden ResourceType Dynamically

4 Answers 157 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Cédric TELLIEZ
Top achievements
Rank 1
Cédric TELLIEZ asked on 10 Jun 2010, 03:30 PM
Hello, I need to hide dynamically some resourceType in the advanced/edit form according to the accesses of the connected user. I use the event OnForm Created but i don't find the correct command to hide/delete some resourceType. Have you a solution because i don't want to create multi-template to edit/delete if it's possible...

(And eventually, have you an idea why <%# Eval("Description")%> doesn't work ?)

I thank you for your help

http://img692.imageshack.us/img692/6023/schedulerx.jpg

Here is my code :

<telerik:RadScheduler ID="RadScheduler1" runat="server" SkinID="Scheduler-FR" 
        DataKeyField="ID_Event" DataSubjectField="Subject" DataStartField="Start" DataEndField="End" 
        DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="ID_RecurrenceParent" 
        DataSourceID="EventsDataSource" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound" 
        OnAppointmentCommand="RadScheduler1_AppointmentCommand"  
        OnAppointmentCreated="RadScheduler1_AppointmentCreated"  
        onformcreated="RadScheduler1_FormCreated"
        <AdvancedForm Modal="true" /> 
        <ResourceTypes> 
            <telerik:ResourceType KeyField="ID_TypeEvent" Name="TypeEvent" TextField="TypeName" ForeignKeyField="ID_TypeEvent" 
                DataSourceID="TypeEventDataSource" /> 
            <telerik:ResourceType KeyField="ID_Room" Name="Room" TextField="RoomName" ForeignKeyField="ID_Room" 
                DataSourceID="RoomsDataSource" /> 
            <telerik:ResourceType KeyField="ID_User" Name="User" TextField="LastName" ForeignKeyField="ID_User" 
                DataSourceID="UsersDataSource" /> 
            <telerik:ResourceType KeyField="ID_Promo" Name="Promo" TextField="PromoName" ForeignKeyField="ID_Promo" 
                DataSourceID="PromoDataSource" /> 
            <telerik:ResourceType KeyField="ID_Campus" Name="Campus" TextField="CampusName" ForeignKeyField="ID_Campus" 
                DataSourceID="CampusDataSource" /> 
        </ResourceTypes> 
        <AppointmentTemplate> 
             <asp:Label runat="server" ID="RecurrenceIcon" /> 
            <%# Eval("Subject") %><br /> 
            --------------------<br /> 
            <asp:Label runat="server" ID="lbl_TypeEvent" /><br /> 
            <asp:Label runat="server" ID="lbl_Room" /><br /> 
            <%# Eval("Description") %> 
            <div style="vertical-align:bottom; text-align: right;"
                <asp:Button runat="server" ID="ButtonExport" CssClass="rsExportButton" ToolTip="Exporter au format iCalendar" 
                CommandName="Export" OnClientClick="Export(this, event); return false;" Style="cursor: pointer; 
                cursor: hand;" /> 
            </div> 
        </AppointmentTemplate> 
        <TimeSlotContextMenuSettings EnableDefault="true" /> 
        <AppointmentContextMenuSettings EnableDefault="true" /> 
    </telerik:RadScheduler> 

    protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e) 
    { 
        RadScheduler scheduler = (RadScheduler) sender; 
        if (e.Container.Mode == SchedulerFormMode.Insert || e.Container.Mode == SchedulerFormMode.AdvancedInsert 
            || e.Container.Mode == SchedulerFormMode.Edit || e.Container.Mode == SchedulerFormMode.AdvancedEdit) 
        { 
 
            //ResourceType typeEvent = e.Appointment.Resources.GetResourceByType("TypeEvent"); 
            Resource typeEvent = e.Appointment.Resources.GetResourceByType("TypeEvent"); 
            Resource room = e.Appointment.Resources.GetResourceByType("Room"); 
            Resource user = e.Appointment.Resources.GetResourceByType("User"); 
            Resource promo = e.Appointment.Resources.GetResourceByType("Promo"); 
            Resource campus = e.Appointment.Resources.GetResourceByType("Campus"); 
            //ResourceCollection resourcecollection = e.Appointment.Resources.Remove(typeEvent); 
            //typeEvent.Available = false; 
            //ResourceData resourcedata = e.Appointment.Resources.Remove(typeEvent); 
        } 
    } 

4 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 10 Jun 2010, 04:02 PM
Hi Cédric,

I suggest you use this kb article to access controls in the advanced form and hide them conditionally.

As for the Description field, you need to enable it as shown in this help topic.


Regards,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Cédric TELLIEZ
Top achievements
Rank 1
answered on 10 Jun 2010, 04:58 PM
Thanks a lot for your fast answer. It works very well for resource and for description. :)

Have a good evening.

Cédric
0
Amit
Top achievements
Rank 1
answered on 03 Mar 2011, 01:38 PM
Hi Telerik Team,

I want to use tool tip feature in ResourceType. i am binding Rooms on to the Scheduler through ResourceType. On mouse hover, i need to show tooltip containing information of that room.

So is it possible to use such feature.?

Revert as soon as possible.

Thanks in advance
Amit Thakkar
0
Peter
Telerik team
answered on 03 Mar 2011, 05:02 PM
Hi Amit,

Here is one possible solution:
<telerik:RadScheduler runat="server" ID="RadScheduler1" GroupBy="User" OnResourceHeaderCreated="RadScheduler1_ResourceHeaderCreated">
       <ResourceHeaderTemplate>
           <asp:Label ID="ResLabel" runat="server"></asp:Label>
       </ResourceHeaderTemplate>
   </telerik:RadScheduler>


protected void RadScheduler1_ResourceHeaderCreated(object sender, ResourceHeaderCreatedEventArgs e)
   {
       Label resLabel = e.Container.FindControl("ResLabel") as Label;
       resLabel.Text = e.Container.Resource.Text;
       resLabel.ToolTip = e.Container.Resource.Key.ToString() + ": You can use this key to query your database and populate the tooltip";
   }


Best wishes,
Peter
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!
Tags
Scheduler
Asked by
Cédric TELLIEZ
Top achievements
Rank 1
Answers by
Peter
Telerik team
Cédric TELLIEZ
Top achievements
Rank 1
Amit
Top achievements
Rank 1
Share this question
or