---
title: Using custom web part layouts
related:
  - https://docs.kentico.com/13/custom-development/extending-the-administration-interface/setting-up-widget-dashboards/creating-dashboard-widgets.md
  - https://docs.kentico.com/13/custom-development/extending-the-administration-interface/developing-web-parts/creating-inherited-web-parts.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

Web part layouts are custom skins that replace the HTML code and ASPX markup of a web part. Layouts allow you to customize the appearance of components that are based on the web part:

- [Dashboard widgets](https://docs.kentico.com/13/custom-development/extending-the-administration-interface/setting-up-widget-dashboards/creating-dashboard-widgets.md)
- [Inherited web parts](https://docs.kentico.com/13/custom-development/extending-the-administration-interface/developing-web-parts/creating-inherited-web-parts.md)

To manage the layouts of web parts, navigate to **Administration interface -> Web parts**, edit a web part and select the **Layouts** tab.

> **Warning:** **Requirement**
>
> The **Control** declaration in the markup of the web part's user control file must contain the  _**full relative path**_  to the code behind file in the **CodeBehind** attribute. For example:
>
> ```csharp
>
> <%@ Control Language="C#" AutoEventWireup="true" Inherits="CMSWebParts_Navigation_cmslistmenu" CodeBehind="~/CMSWebParts/Navigation/cmslistmenu.ascx.cs" %>
>
> ```
>
> We do not recommend calling any inline code in the web part layout file itself. Such custom code can be hard to maintain across different versions of Xperience if the code of the underlying web part changes. Only use the web part layout to extend or reorganize the web part's markup or HTML.
>
> If you need to call custom code, [create a custom web part based on the original](https://docs.kentico.com/13/custom-development/extending-the-administration-interface/developing-web-parts/customizing-web-parts.md).

> **Note:** **Do not remove controls from the layout**
>
> Keep all of the default controls inside the code of web part layouts to ensure that web parts work correctly. If you need to hide any of the controls, add the  _**Visible="False"**_  attribute.
>
> **Note**: Your custom web part layouts may not work after upgrading to a new version of Xperience (if the controls in the web part's markup changed). Please test your website carefully after upgrading, and update your custom layouts according to the controls in the default layout if necessary.

## Assigning layouts to dashboard widgets

To select the layout for a dashboard widget:

1. Open the **Administration interface** application and select the **Widgets** tab.
2. Select a widget based on the web part for which you have created the custom layout.
3. On the **General** tab, choose the **Layout**.
   - The _(Default)_ layout uses the markup of the web part's source file.
4. Click **Save**.

The appearance and content of the dashboard widget is now based on the assigned layout.

## Setting default layouts for inherited web parts

You can prepare specialized versions of web parts that use a specific layout by default:

1. Open the **Administration interface** application and switch to the **Web parts** tab.
2. Create an [inherited web part](https://docs.kentico.com/13/custom-development/extending-the-administration-interface/developing-web-parts/creating-inherited-web-parts.md) based on the web part you want to modify.
3. On the **Layouts** tab of the inherited web part, define the required custom layout.
4. Enable the **Is default** option of the given layout.
   - An inherited web part cannot have more than one default layout at a given time.
   - If there is no default layout, the inherited web part uses the default markup of the parent web part.

The system automatically assigns the selected layout to new instances of the inherited web part.
