Learning Kentico: Web Parts & Widgets

Wow!This topic has been on my draft since November 2018 but was never published. So I revisited what I have learned from Web Parts and below are some my notes:

Web Parts
- user controls (.ascx) that needs to inherit from Kentico base classes to ensure that the web part will be properly displayed and that you can manage its properties.

kentico base class,  CMSAbstractWebPart
CMSAbstractWebPart - Kentico base class inherited (for standard listing)

- used on the Design tab of the Pages application
- components that allow you to easily introduce built-in and custom functionality on your website

How to implementing a custom web part?

1. Register web part in web parts application
2. Make sure the web part created inherits to the right/suitable class

- each widget is based on a web part
- needs to be placed inside the widget zones
- called as web parts with hidden properties because this is used by non-technical users (they can only access the important properties but not the advanced properties)

Working with Component Events

- a feature that allows certain parts of the system to communicate.
- One of the most common usages is when you need two or more different web parts to share information.

1. request events - fired and survive only within the current request (executed upon each request or page load)
2. global events - fired and survive across during the whole application lifetime (used for complex events that do not depend on single request)

Two Parts:
1. registering an event
2. raising an event

I also learned about these namespaces:
using System.Collections.Generic - used for List
using CMS.Data.Engine = used for Query Operator
using System.Linq = used for ToList

As for the exercises, I couldn't make the 2nd exercise work. I was able to display the list of appointments assigned to a doctor specified in the FilterDoctor web part property.  But I'm confused why it isn't showing in the page. I can't obviously proceed to the third one as it requires a communication between two separate web parts. (Need the contact doctor exercise and appointment list to be on the same page). :(

I'll see in the next lesson (Macros) if I could make it work. I know they are connected. Good luck to me! 

No comments:

Post a Comment

Post Top Ad