New to Telerik UI for ASP.NET MVC? Start a free 30-day trial

Defines the fluent API for configuring the Telerik UI Badge for ASP.NET MVC.

Definition

Constructors

Initializes a new instance of the Badge class.

C#
public BadgeBuilder(Badge component)
Parameters:componentBadge

The component.

Methods

Defines the alignment of the Badge when it is integrated into a Button.

C#
public BadgeBuilder Align(BadgeAlign value)
Parameters:valueBadgeAlign

The value that configures the Badge alignment.

Returns:

BadgeBuilder

Example:
C#
@(Html.Kendo().Button()
.Name("save")
.Content("Save")
.Badge(b => b
.Align(BadgeAlign.TopStart)
.Icon("save")
)
)

Specifies whether or not to render an additional "cutout" border around the Badge.

C#
public BadgeBuilder CutoutBorder(bool value)
Parameters:valuebool

The value that enables the border.

Returns:

BadgeBuilder

Example:
C#
@(Html.Kendo().Badge()
.Name("badge")
.CutoutBorder(false)
)

Determines whether the textual content should be rendered as an HTML string or it should be encoded.

C#
public BadgeBuilder Encoded(bool value)
Parameters:valuebool

The value that configures the encoded.

Returns:

BadgeBuilder

Defines how theme colors are applied to a Badge.

C#
public BadgeBuilder FillMode(BadgeFill value)
Parameters:valueBadgeFill

The value that configures the fill mode.

Returns:

BadgeBuilder

Example:
C#
@(Html.Kendo().Badge()
.Name("badge")
.Text("user")
.FillMode(BadgeFill.Outline)
)

Defines the name for an existing icon in a Kendo UI theme or SVG content. The icon is rendered inside the Badge by a 'span.k-icon' or 'span.k-svg-icon' element.

C#
public BadgeBuilder Icon(string value)
Parameters:valuestring

The value that configures the icon.

Returns:

BadgeBuilder

Example:
C#
@(Html.Kendo().Badge()
.Name("badge")
.Icon("user")
)

If text is a number, it will cap that number.

C#
public BadgeBuilder Max(double value)
Parameters:valuedouble

The value that configures the max.

Returns:

BadgeBuilder

Example:
C#
@(Html.Kendo().Badge()
.Name("badge")
.Text(100.2f)
.Max(99)
)

Defines the position of the Badge when it is integrated into a Button.

C#
public BadgeBuilder Position(BadgePosition value)
Parameters:valueBadgePosition

The value that configures the position.

Returns:

BadgeBuilder

Example:
C#
@(Html.Kendo().Button()
.Name("save")
.Content("Save")
.Badge(b => b
.Position(BadgePosition.Edge)
.Icon("save")
)
)

Defines the rounded appearance of the Badge.

C#
public BadgeBuilder Rounded(Rounded value)
Parameters:valueRounded

The value that configures the rounding of the Badge.

Returns:

BadgeBuilder

Example:
C#
@(Html.Kendo().Badge()
.Name("badge")
.Text("Most Popular")
.Rounded(Rounded.Large)
)

Defines the size of the Badge.

C#
public BadgeBuilder Size(BadgeSize value)
Parameters:valueBadgeSize

The value that configures the size.

Returns:

BadgeBuilder

Example:
C#
@(Html.Kendo().Badge()
.Name("badge")
.Text("Most Popular")
.Size(BadgeSize.Large)
)

The template that renders the content of the Badge.

C#
public BadgeBuilder Template(string value)
Parameters:valuestring

The value that configures the template.

Returns:

BadgeBuilder

Example:
C#
@(Html.Kendo().Badge()
.Name("badge")
.Text("120")
.Template("#= +this._text > 100 ? 'a lot' : this._text #")
)

The template that renders the content of the Badge.

C#
public BadgeBuilder Template<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the template.

Returns:

BadgeBuilder

The template that renders the content of the Badge.

C#
public BadgeBuilder TemplateHandler(string value)
Parameters:valuestring

The value that configures the template.

Returns:

BadgeBuilder

Example:
C#
@(Html.Kendo().Badge()
.Name("badge")
.Text("100")
.TemplateHandler("getBadgeContent")
)
&lt;script&gt;
function getBadgeContent() {
if(this._text &gt; 100) {
return 'a lot';
} else return this._text;
}
&lt;/script&gt;

The template that renders the content of the Badge.

C#
public BadgeBuilder TemplateId(string value)
Parameters:valuestring

The value that configures the template.

Returns:

BadgeBuilder

Example:
C#
@(Html.Kendo().Badge()
.Name("badge")
.Text("15")
.TemplateId("sentTemplate")
)
&lt;script id="sentTemplate" type="text/x-kendo-template"&gt;
#= this._text # items
&lt;/script&gt;

The template that renders the content of the Badge.

C#
public BadgeBuilder TemplateView(MvcHtmlString value)
Parameters:valueMvcHtmlString

The value that configures the template.

Returns:

BadgeBuilder

Example:
C#
@(Html.Kendo().Badge()
.Name("badge")
.Text("100")
.TemplateView(Html.Partial("BadgeTemplateView"))
)

The text of the Badge. The valid input includes a string, number, or object with the 'toString()' method. The default value is an empty string.

C#
public BadgeBuilder Text(float value)
Parameters:valuefloat

The value for the Text option.

Returns:

BadgeBuilder

Example:
C#
@(Html.Kendo().Badge()
.Name("badge")
.Text("100")
)

The text of the Badge. The valid input includes a string, number, or object with the 'toString()' method. The default value is an empty string.

C#
public BadgeBuilder Text(string value)
Parameters:valuestring

The value for the Text option.

Returns:

BadgeBuilder

Example:
C#
@(Html.Kendo().Badge()
.Name("badge")
.Text("Most Popular")
)

Defines the color applied of the Badge.

C#
public BadgeBuilder ThemeColor(BadgeColor value)
Parameters:valueBadgeColor

The value that configures the theme color.

Returns:

BadgeBuilder

Example:
C#
@(Html.Kendo().Badge()
.Name("badge")
.Text("user")
.ThemeColor(BadgeColor.Primary)
)

If set to 'false', the Badge will not be displayed.

C#
public BadgeBuilder Visible(bool value)
Parameters:valuebool

The value that configures the visibility of the Badge.

Returns:

BadgeBuilder

Example:
C#
@(Html.Kendo().Badge()
.Name("badge")
.Text("Most Popular")
.Visible(false)
)