Issue with RadzenTextArea in Blazor Web Application (Interactive Mode Server)

Hi Radzen Team,

I am currently working on a Blazor Web Application (Interactive Mode Server) and have encountered an issue with the RadzenTextArea component. Below is a snippet of the code used on the index page:

<PageTitle>Index</PageTitle>
<RadzenTextArea @bind-Value="@text" style="width: 100%; height: 400px" />
<RadzenText>@text.Length</RadzenText>

The problem arises when inputting long text (length > 17000) into RadzenTextArea, resulting in an error. Strangely, the component works fine with shorter text (length < 16000). For testing purposes, I used the following tool to generate random text: Random String Generator - Create Random Text and Numbers - Online - Browserling Web Developer Tools.

Could you please provide guidance on how to fix this?

Best regards

You have probably reached the maximum SignalR message size. You can try increasing it.

services.AddServerSideBlazor().AddHubOptions(o => 
{ 
o.MaximumReceiveMessageSize = 10 * 1024 * 1024; // 10MB 
});

Thank you for your prompt response. The issue has been resolved.

btw: I check create Blazor Web Application (Interactive Mode Server) with RBS not include this code, while create server app with .net 7 version have it

I too ran into this old chestnut yesterday but was able to resolve using Microsoft's suggestion of streaming the content back with a JS interop as per this:

large-form-payloads-and-the-signalr-message-size-limit

This doesn't require changing the message size and you can configure the max size per field..

but I was unable to do this with RadzenTextarea as it didn't like me using @ref - it returned this error:
CS0029 Cannot implicitly convert type 'Radzen.Blazor.RadzenTextArea' to 'Microsoft.AspNetCore.Components.ElementReference'

I'm happy with my solution but maybe Radzen Team can make @ref work for RadzenTextArea or the HTML field for future?

Since RadzenTextArea is not generic HTML element you cannot use ElementReference - should be RadzenTextArea.

thanks. Yes, so can JavaScript query the content of a RadzenTextArea then in the same way?

RadzenTextArea textArea;

async Task<string> GetTextAsync()
{
    try
    {
        var streamRef =
            await JS.InvokeAsync<IJSStreamReference>("getText", textArea.Element);
        var stream = await streamRef.OpenReadStreamAsync(maxAllowedSize: 50_000);
        var streamReader = new StreamReader(stream);

        return await streamReader.ReadToEndAsync();
    }
    catch (JSException jsException)
    {
        if (jsException.InnerException is
                ArgumentOutOfRangeException outOfRangeException &&
            outOfRangeException.ActualValue is not null &&
            outOfRangeException.ActualValue is long actualLength &&
            actualLength == 0)
        {
            return string.Empty;
        }

        throw;
    }
}

async Task ButtonClick()
{
    var text = await GetTextAsync();
    console.Log($"TextArea value: {text}");
}

All Radzen Blazor components have Element property which is reference to the main HTML element.

ah ha!! good to know - thanks!

Curiously, I still could not get this to work with this change. I've had to switch back to the regular text area solution for now. Don't have time to persist with it.