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

Appointment Template - show link based on resource type

1 Answer 99 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Ben
Top achievements
Rank 1
Ben asked on 25 Feb 2012, 12:42 PM
Hi

In my appointment template, I have a hyperlink where I am passing the ID to a new page using query string. I only want to show this hyperlink if the resource type is equal to "Clubs". Is this possible?

<telerik:RadScheduler ID="RadScheduler1" runat="server" DataDescriptionField="Description"
    DataEndField="EndDate" DataKeyField="ID" DataRecurrenceField="RecRule" DataRecurrenceParentKeyField="Type"
    DataSourceID="sqlDSTodaysEvents" DataStartField="StartDate" DataSubjectField="Name"
    EnableDescriptionField="True" Height="" ReadOnly="True" ShowAllDayRow="False"
    ShowFooter="False" TimeLabelRowSpan="1" Culture="en-GB" NumberOfHoveredRows="1"
    RowHeight="49px" EnableExactTimeRendering="True" ShowNavigationPane="False" ShowResourceHeaders="False"
    ShowViewTabs="False" ShowHeader="False" SkinID="Default" DataReminderField="ReminderInfo"
    Skin="Sitefinity" MinutesPerRow="60" FirstDayOfWeek="Monday" LastDayOfWeek="Sunday"
    WorkDayEndTime="16:00:00">
    <ResourceTypes>
        <telerik:ResourceType DataSourceID="sqlDSEventDef" ForeignKeyField="EventTypeID"
            KeyField="EventTypeID" Name="Type" TextField="EventType" />
    </ResourceTypes>
    <ResourceStyles>
        <telerik:ResourceStyleMapping Type="Type" Text="Lessons" ApplyCssClass="" BackColor="#66CCFF" />
        <telerik:ResourceStyleMapping Type="Type" Text="Clubs" ApplyCssClass="" BackColor="#FFCC00" />
        <telerik:ResourceStyleMapping Type="Type" Text="Trips" ApplyCssClass="" BackColor="#FF66CC" />
    </ResourceStyles>
    <Reminders Enabled="False" />
    <WebServiceSettings>
        <ODataSettings InitialContainerName="">
        </ODataSettings>
    </WebServiceSettings>
    <AppointmentTemplate>
        <div>
            <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# "register.aspx?ClubID=" + Eval("ID") %>'><%# Eval("Subject") %></asp:HyperLink>
        </div>
    </AppointmentTemplate>
</telerik:RadScheduler>

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 27 Feb 2012, 05:31 PM
Hi Ben,

Yes, this is possible. Please, take a look at this online demo.  Note how the recurrence image panel is made visible conditionally in AppointmentCreated. The same technique should suffice for a resource link as well.
protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e)
       {
           if (e.Appointment.RecurrenceState == RecurrenceState.Master || e.Appointment.RecurrenceState == RecurrenceState.Occurrence)
           {
               Panel recurrenceStatePanel = e.Container.FindControl("RecurrencePanel") as Panel;
               recurrenceStatePanel.Visible = true;
           }
           if (e.Appointment.RecurrenceState == RecurrenceState.Exception)
           {
               Panel recurrenceExceptionPanel = e.Container.FindControl("RecurrenceExceptionPanel") as Panel;
               recurrenceExceptionPanel.Visible = true;
           }
           if (e.Appointment.Reminders.Count != 0)
           {
               Panel reminderPanel = e.Container.FindControl("ReminderPanel") as Panel;
               reminderPanel.Visible = true;
           }
       }


All the best, Peter
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.
Tags
Scheduler
Asked by
Ben
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or