Hidden ResourceType Dynamically

5 posts, 0 answers
  1. Cédric TELLIEZ
    Cédric TELLIEZ avatar
    2 posts
    Member since:
    May 2010

    Posted 10 Jun 2010 Link to this post

    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); 
            } 
        } 

  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 10 Jun 2010 Link to this post

    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.
  3. Cédric TELLIEZ
    Cédric TELLIEZ avatar
    2 posts
    Member since:
    May 2010

    Posted 10 Jun 2010 Link to this post

    Thanks a lot for your fast answer. It works very well for resource and for description. :)

    Have a good evening.

    Cédric
  4. Amit
    Amit avatar
    10 posts
    Member since:
    Feb 2011

    Posted 03 Mar 2011 Link to this post

    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
  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 03 Mar 2011 Link to this post

    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!
Back to Top