How to render raw HTML in Blazor Scheduler events template?
In Syncfusion's Blazor Scheduler, you can customize the event template from a raw HTML string using the MarkupString option in Blazor.
Step 2: Define the ScheduleEventSettings and Template.
Inside the ScheduleEventSettings, define a Template, that supports both Render fragment and MarkupString. If you are retrieving the template as HTML string from the database, you can use MarkupString to convert html string into respective HTML DOM elements.
[index.razor]
<ScheduleEventSettings DataSource="@DataSource"> <Template> <div>Subject: {data.Subject}</div> <div>StartTime: {data.StartTime}</div> <div>EndTime: {data.EndTime}</div> <div>Description: @((MarkupString)(context as AppointmentData).Description)</div> </Template> </ScheduleEventSettings> </SfSchedule> @code { List<AppointmentData> DataSource = new List<AppointmentData> { new AppointmentData {Id = 1, Subject = "Meeting", StartTime = new DateTime(2020, 1, 31, 9, 30, 0) , EndTime = new DateTime(2020, 1, 31, 11, 0, 0), Description= "<div>Don't fail to join</div>" } }; } |
Conclusion
I hope you enjoyed learning about how to render raw HTML in Blazor Scheduler events template?.
You can refer to our Blazor Scheduler feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Blazor Scheduler example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!