RadzenFormField - format one character in Text property

Hi!

Is there a way to format just a single character in the RadzenFormField text property? For example - we need to be able to show "Name*" where the asterisk is a different color. It cannot be put into the helper section below the control - it needs to be integrated with the FormField label.

It looks like just using html in the Text property does not work as it prints "Name *". I've also tried using (MarkupString) in the Text property (see below) but it throws an error that the text property expects a string and not MarkupString.

<RadzenFormField Text="@((MarkupString)"<b>Login</b><font color: red>*</font>")" Style="width:100%" AllowFloatingLabel=false>

Is there a way to achieve this? Thanks!

Hi @azrarayne,

For this specific scenario you can use a simple CSS rule.

Add a css class to the FormField, e.g. <RadzenFormField Text="Name" Class="required">

Add the following style to your page:

<style>
.required .rz-form-field-label:after {
    content: "*";
    color: red;
    margin-left: 2px;
}
</style>
2 Likes

Thanks! Looks like I was totally overthinking this lol.