Hello Bernard,
Indeed, an ID is important for the described scenario. Here is how to add it with JavaScript until we implement the built-in attribute.
@inject IJSRuntime js
<p><label for="foo-id">Label for Blazor Upload</label></p>
<TelerikUpload Class="foo-id"
@ref="@MyUpload"
Multiple="false">
</TelerikUpload>
<!-- Allow the <script> tag to reside here in the Razor file for this workaround -->
<script suppress-error="BL9992">function addUploadId(uploadClass) {
var uploadInput = document.querySelector("." + uploadClass + " input");
if (uploadInput) {
uploadInput.setAttribute("id", uploadClass);
}
}</script>
@code {
TelerikUpload MyUpload { get; set; }
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await js.InvokeVoidAsync("addUploadId", MyUpload.Class);
}
await base.OnAfterRenderAsync(firstRender);
}
}
Regards,
Dimo
Progress Telerik