.NET USER CONTROLS

.NET user controls provide an endless number of possibilities for your Umbraco installation. With user controls you can harness the power of .NET code inside your templates and content pages. If you can create something in a custom .NET application inside a user control, it's also possible to render/function it in an Umbraco rendered page.

image Remember to have a <form runat=“server”/> tag in your template that encapsulates the user control. If you don't, the user control will not work.

This section shows how to extend the user experience by adding dynamic form functionality, as well as how to create custom data types for user input in the backoffice.

image For detailed information on how to tap into the Umbraco Event Model, go to Chapter 12.

Using the built-in wrapper makes deploying custom code a real breeze. The simplest and most straightforward way to work with Umbraco and custom code is to create a standalone Visual Studio project in—basically—6 steps.

  1. Add your user controls (.ascx files).
  2. Write the code as needed.
  3. Build your solution and/or project.
  4. Copy the .ascx file(s) to the <install root>/usercontrols folder and copy the project DLL and any other dependency libraries used to the <install root>/bin folder.
  5. Create a macro, just like you did in the “Introduction ...

Get Umbraco User's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.