Contents
- Label position
- Label template
Having trouble getting help?
Contact Support
Contact Support
Labels in ASP.NET MVC Rating Control
23 Jan 20232 minutes to read
You can use the ShowLabel property to display a label that shows the current value of the rating. When the ShowLabel
property is set to true
, a label will be displayed.
@using Syncfusion.EJ2.Inputs
@Html.EJS().Rating("rating").Value(3).ShowLabel(true).Render()
public ActionResult ShowLabel()
{
return View();
}
Label position
The Rating control allows you to place the label on the top, bottom, left, or right side of the rating using the LabelPosition property.
The following label positions are supported:
- Top: The label is placed on the top of the rating.
- Bottom: The label is placed on the bottom of the rating.
- Left: The label is placed on the left side of the rating.
- Right: The label is placed on the right side of the rating.
@using Syncfusion.EJ2.Inputs
<label>Left Label Position</label><br />
@Html.EJS().Rating("rating1").Value(3).ShowLabel(true).LabelPosition(LabelPosition.Left).Render()<br />
<label>Right Label Position</label><br />
@Html.EJS().Rating("rating2").Value(3).ShowLabel(true).LabelPosition(LabelPosition.Right).Render()<br />
<label>Top Label Position </label><br />
@Html.EJS().Rating("rating3").Value(3).ShowLabel(true).LabelPosition(LabelPosition.Top).Render()<br />
<label>Bottom Label Position</label><br />
@Html.EJS().Rating("rating4").Value(3).ShowLabel(true).LabelPosition(LabelPosition.Bottom).Render()<br />
public ActionResult LabelPosition()
{
return View();
}
Label template
You can use the LabelTemplate tag directive to specify a custom template for the Label
of the rating. The current value of the rating will be passed as the value
property in the template context when building the content of the label. This allows you to include dynamic information about the rating in the template.
@using Syncfusion.EJ2.Inputs
@Html.EJS().Rating("rating").Value(3).ShowLabel(true).LabelTemplate("<span>${value} Out Of 5</span>").Render()
public ActionResult LabelTemplate()
{
return View();
}