-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Two errors in version 5.0.3 #406
Comments
I believe the Excel error was created by Commit 578d768. |
You are right. The issue about excel export is due to disposing the stream. I've published a new version (5.0.4) to fix it. Referring the displayed language, I understand that the issue happens also in version 4.1.1, doesn't it? Are you using blazor-server or blazor-wasm? |
yes, the language displayed error is also happens in version 4.1.1 with blazor-server. |
You can look at this sample project https://gridblazor.azurewebsites.net/. It is implemented as a blazor-server project. The source code is here https://github.com/gustavnavar/Grid.Blazor/tree/master/GridBlazorServerSide. There is a blazor component that configures the language for each session: @using System.Globalization
@using Microsoft.AspNetCore.Builder
@using Microsoft.Extensions.Options
@inject NavigationManager NavigationManager
@inject IOptions<RequestLocalizationOptions> LocOptions
<select class="form-control" value="@_language" @onchange="SetLanguage">
@foreach (var culture in LocOptions.Value.SupportedUICultures)
{
<option value="@culture.Name">@culture.Name</option>
}
</select>
@code {
private string _language;
protected override void OnInitialized()
{
_language = CultureInfo.CurrentCulture.Name;
}
private void SetLanguage(ChangeEventArgs e)
{
var culture = (string)e.Value;
var uri = new Uri(NavigationManager.Uri)
.GetComponents(UriComponents.PathAndQuery, UriFormat.Unescaped);
var query = $"?culture={Uri.EscapeDataString(culture)}&" +
$"redirectUri={Uri.EscapeDataString(uri)}";
NavigationManager.NavigateTo("/Culture/SetCulture" + query, forceLoad: true);
}
} It calls to a web service that configures a cookie for the language: using Microsoft.AspNetCore.Localization;
using Microsoft.AspNetCore.Mvc;
namespace GridBlazorServerSide.Controllers
{
[Route("[controller]/[action]")]
public class CultureController : Controller
{
public IActionResult SetCulture(string culture, string redirectUri)
{
if (culture != null)
{
HttpContext.Response.Cookies.Append(
CookieRequestCultureProvider.DefaultCookieName,
CookieRequestCultureProvider.MakeCookieValue(
new RequestCulture(culture)));
}
return LocalRedirect(redirectUri);
}
}
} |
The text was updated successfully, but these errors were encountered: