---
title: "How to disable Tag Helper at the element level?"  
description: "How to disable Tag Helper at the element level?"  
author: "Revati S Misra"  
published: 2023-03-06  
updated: 2023-07-08  
canonical: https://www.mindstick.com/forum/157456/how-to-disable-tag-helper-at-the-element-level  
category: "asp.net core"  
tags: ["asp.net", "asp.net core"]  
reading_time: 2 minutes  

---

# How to disable Tag Helper at the element level?

How to [disable](https://www.mindstick.com/forum/12901/how-to-disable-enable-input-box-in-aspx-with-value-from-sql) Tag Helper at the element level?

## Replies

### Reply by Aryan Kumar

To disable a tag helper at the element level, you can use the `!` character before the opening tag. For example, the following code will disable the `label` tag helper:

HTML

```plaintext
<!label for="username">Username</label>
```

The `!` character tells the tag helper to not render any HTML. This can be useful if you want to conditionally disable a tag helper, based on some condition. For example, you could use the `!` character to disable a tag helper if a user is not logged in.

Here is an example of how to conditionally disable the `label` tag helper:

HTML

```plaintext
@if (User.Identity.IsAuthenticated)
{
    <label for="username">Username</label>
}
```

In this example, the `label` tag helper will only be rendered if the user is logged in. If the user is not logged in, the `label` tag helper will not be rendered.

You can also disable a tag helper at the view level by using the `@removeTagHelper` directive. For example, the following code will remove the `label` tag helper from all views in the current folder:

HTML

```plaintext
@removeTagHelper TagHelperName="label"
```

The `@removeTagHelper` directive can be used to disable any tag helper, regardless of the element level. This can be useful if you want to disable a tag helper globally, for all views in your application.


---

Original Source: https://www.mindstick.com/forum/157456/how-to-disable-tag-helper-at-the-element-level

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
