Is this really the version you are looking for? Kentico Xperience 8.2 Tutorial is no longer updated. Use the switcher in the header to choose your product version.
The easiest way to insert custom code into a portal engine based website is using standard ASCX user controls. If you are not familiar with Visual Studio development, you can skip this page.
In this example, we will create a simple user control (ASCX) using Visual Studio and integrate it into the Home page.
Open the website project using the WebSite.sln or WebApp.sln file, which is located in the folder where you installed the website.
Create a Web User Control and set its name to *GetTime.ascx.*You can set the programming language option to either Visual C# or Visual Basic.
Drag the following ASP.NET controls onto the page from the toolbox and set their properties:
Button control:
Label control:
Switch to the Design view and double-click the Show current time button.
Enter the following code into the Button1_Click method:
Label1.Text = DateTime.Now.ToString();Save the user control's files.
The code ensures that the label displays the current date and time when the button is clicked. You do not need to build the project — user controls are compiled at run time.
Switch to Preview mode to see the user control's output on the page. When you click the Get time button, the current date and time appears next to the button.
User controls versus web parts
You can also insert custom code onto portal pages by creating your own web parts. Web parts are very similar to user controls, but with a built-in portal engine configuration interface. We recommend building web parts if you need easily re-usable and configurable user controls.
For more information, see Developing web parts in the main documentation.