- 
                Notifications
    You must be signed in to change notification settings 
- Fork 80
Added new kb article scheduler-add-hyperlinks-in-appointments #3282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
            xristianstefanov
  merged 2 commits into
  master
from
new-kb-scheduler-add-hyperlinks-in-appointments-d29cf477f00c494280733d545b0502bd
  
      
      
   
  Oct 14, 2025 
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            2 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      
    File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
        
          
  
    
      
          
            142 changes: 142 additions & 0 deletions
          
          142 
        
  knowledge-base/scheduler-add-hyperlinks-in-appointments.md
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| --- | ||
| title: How to Add Hyperlinks in Scheduler Appointments | ||
| description: Learn how to add clickable hyperlinks in Scheduler appointments in UI for Blazor. | ||
| type: how-to | ||
| page_title: Making Links Clickable in Scheduler Appointment Descriptions | ||
| meta_title: Make Links Clickable in Scheduler Appointment Descriptions | ||
| slug: scheduler-kb-add-hyperlinks-in-appointments | ||
| tags: scheduler, templates, appointments, hyperlinks | ||
| res_type: kb | ||
| ticketid: 1697204 | ||
| --- | ||
|  | ||
| ## Environment | ||
| <table> | ||
| <tbody> | ||
| <tr> | ||
| <td>Product</td> | ||
| <td>Scheduler for Blazor</td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
|  | ||
| ## Description | ||
|  | ||
| I want to add clickable hyperlinks in Scheduler appointments. Including plain URLs in the Description field without having to write full `<a>` tags would be good. | ||
|  | ||
| ## Solution | ||
|  | ||
| To achieve clickable hyperlinks in Scheduler appointments, implement a method to automatically detect and convert plain URLs in the Description field into clickable links. | ||
|  | ||
| 1. Use the [`ItemTemplate`](slug:scheduler-templates-appointment) of the Scheduler to customize appointment rendering. | ||
| 2. Apply a helper method to parse the Description field and convert plain URLs to clickable links. | ||
|  | ||
| Here’s an example: | ||
|  | ||
| ````Razor | ||
| <TelerikScheduler Data="@Appointments" @bind-Date="@StartDate" @bind-View="@CurrView" Height="600px" Width="800px"> | ||
| <ItemTemplate> | ||
| @{ | ||
| var appointment = context as SchedulerAppointment; | ||
| var formattedDescription = ConvertUrlsToLinks(appointment.Description); | ||
| } | ||
| <div style="padding: 10px;" @onclick:stopPropagation> | ||
| @((MarkupString)formattedDescription) | ||
| </div> | ||
| </ItemTemplate> | ||
|  | ||
| <AllDayItemTemplate> | ||
| @{ | ||
| var appointment = context as SchedulerAppointment; | ||
| } | ||
| @appointment.Title | ||
| <span> | ||
| Starts on @appointment.Start.Date.ToShortDateString() | ||
| ends on @appointment.End.Date.ToShortDateString() | ||
| </span> | ||
| </AllDayItemTemplate> | ||
|  | ||
| <SchedulerViews> | ||
| <SchedulerDayView StartTime="@DayStart" /> | ||
| <SchedulerWeekView StartTime="@DayStart" /> | ||
| <SchedulerMonthView> | ||
| <ItemTemplate> | ||
| @{ | ||
| var appointment = context as SchedulerAppointment; | ||
| if (appointment.IsAllDay) | ||
| { | ||
| <span>@appointment.Title</span> | ||
| } | ||
| else | ||
| { | ||
| <div title="@appointment.Title" style="font-size: small"> | ||
| @appointment.Start.ToShortTimeString() to @appointment.End.ToShortTimeString() | ||
| </div> | ||
| } | ||
| } | ||
| </ItemTemplate> | ||
| </SchedulerMonthView> | ||
| </SchedulerViews> | ||
| </TelerikScheduler> | ||
|  | ||
| @code { | ||
| private DateTime StartDate { get; set; } = new DateTime(2019, 11, 29); | ||
| private SchedulerView CurrView { get; set; } = SchedulerView.Week; | ||
| private DateTime DayStart { get; set; } = new DateTime(2000, 1, 1, 8, 0, 0); // the time portion is important | ||
|  | ||
| private List<SchedulerAppointment> Appointments = new() | ||
| { | ||
| new SchedulerAppointment | ||
| { | ||
| Title = "Vet visit", | ||
| Description = "Check this link: https://demos.telerik.com/blazor-ui/scheduler/templates", | ||
| Start = new DateTime(2019, 11, 26, 11, 30, 0), | ||
| End = new DateTime(2019, 11, 26, 12, 30, 0) | ||
| }, | ||
| new SchedulerAppointment | ||
| { | ||
| Title = "Planning meeting", | ||
| Description = "Details here: https://demos.telerik.com/blazor-ui/scheduler/events", | ||
| Start = new DateTime(2019, 11, 25, 9, 30, 0), | ||
| End = new DateTime(2019, 11, 25, 12, 45, 0), | ||
| Icon = SvgIcon.ExclamationCircle | ||
| }, | ||
| new SchedulerAppointment | ||
| { | ||
| Title = "Trip to Hawaii", | ||
| Description = "Info at www.travelagency.com/hawaii", | ||
| IsAllDay = true, | ||
| Start = new DateTime(2019, 11, 27), | ||
| End = new DateTime(2019, 12, 07) | ||
| } | ||
| }; | ||
|  | ||
| public class SchedulerAppointment | ||
| { | ||
| public string Title { get; set; } | ||
| public string Description { get; set; } | ||
| public DateTime Start { get; set; } | ||
| public DateTime End { get; set; } | ||
| public bool IsAllDay { get; set; } | ||
| public ISvgIcon Icon { get; set; } | ||
| } | ||
|  | ||
| private string ConvertUrlsToLinks(string input) | ||
| { | ||
| if (string.IsNullOrWhiteSpace(input)) | ||
| return string.Empty; | ||
|  | ||
| // Regex to match URLs like http://, https://, or www. | ||
| var urlPattern = @"((http|https):\/\/[^\s]+|www\.[^\s]+)"; | ||
| return System.Text.RegularExpressions.Regex.Replace(input, urlPattern, match => | ||
| { | ||
| var url = match.Value; | ||
| var href = url.StartsWith("http", StringComparison.OrdinalIgnoreCase) ? url : "https://" + url; | ||
| return $"<a href=\"{href}\" target=\"_blank\">{url}</a>"; | ||
| }); | ||
| } | ||
| } | ||
| ```` | ||
|  | ||
| ## See Also | ||
| - [Scheduler Appointment Templates](scheduler-templates-appointment) | ||
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.