'How can I use font awesome icon in asp.net Label?
When the asp:Label Text attribute have some value and there is a fa icon in it, only the icon is visible. I want both text and the icon to be visible.
<asp:Label ID="Label18" runat="server" Text="Company Status"><i class="fas fa-chevron-right "></i></asp:Label>
This code results into showing only the icon. How can I have the icon and the text side by side without removing it from Label tag.
Solution 1:[1]
With the aspnet's label component, what is inside the Tag will be overwritten by the Text property.
You can add an icon in the Text property along with the text, alternatively try this
In frontend:
<asp:Label ID="Label18" runat="server"></asp:Label>
In backend:
var Label = Label18;
Label.Text = "<i class='fas fa-chevron-right'></i> Company Status";
The result after run application:
<span id="Label18"><i class="fas fa-chevron-right"></i> Company Status</span>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
