Label Control
The Label control displays the associated value by applying formatting based on the DataType.
Personalization
By using the ProcessOnGetValueAsync method, you can process the value to change the text to display.
In this example, the file size is processed to format its value.
using System;
using System.Threading;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using DataWeb.Structure;
using DataWeb.Identity;
using DataWeb.Media;
namespace DataWeb.Data.Controls
{
public class File_Length(Form form, IServiceProvider serviceProvider) : Label(form, serviceProvider)
{
private readonly IMediaService mediaService = serviceProvider.GetService<IMediaService>();
public override Task<object> ProcessOnGetValueAsync(object value, Dictionary<string, object> sectionData, IUser user, string itemId = null, NavigationContext navigationContext = null, CancellationToken cancellationToken = default)
{
return Task.FromResult(value != null ? (object)mediaService.BytesToString(Convert.ToInt64(value)) : null);
}
}
}