Telerik Forums
UI for Blazor Forum
0 answers
633 views

Hello, I get this error on Asp Net 5 WebApi:

Access to XMLHttpRequest at 'http://localhost:5000/Api/curvapeso/upload/azienda/716' from origin 'https://localhost:44344' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

And the endpoint (Upload() action below) isn't reached.

This is my CORS configuration:

            services.AddCors(options =>
            {
                options.AddPolicy("CorsPolicy",
                    builder =>
                    {
                        builder.AllowAnyOrigin()
                            .AllowAnyMethod()
                            .AllowAnyHeader();
 
                        if (string.IsNullOrEmpty(origin))
                        {
                            builder.AllowAnyOrigin();
                        }
                        else
                        {
                            builder.WithOrigins(origin);
                        }
 
                    });
            });
 
...
app.UseCors("CorsPolicy");

 

This is my upload endpoint, and Options handler (see in this post and suggested by the docs):

[HttpOptions("upload/azienda/{idazienda}")]
[AllowAnonymous]
public static IActionResult FileOptions(HttpRequest req)
{
    string originSite = req.Headers["Origin"];
    req.HttpContext.Response.Headers.Add("Access-Control-Allow-Origin", originSite);
    req.HttpContext.Response.Headers.Add("Access-Control-Allow-Methods", "POST, GET, OPTIONS");
    req.HttpContext.Response.Headers.Add("Access-Control-Allow-Credentials", "true");
    req.HttpContext.Response.Headers.Add("Access-Control-Allow-Headers", "X-PINGOTHER, Content-Type");
    return new NoContentResult();
}
 
[HttpPost("upload/azienda/{idazienda}")]
public async Task<IActionResult> Upload(IEnumerable<IFormFile> files, int idazienda, HttpRequest req)
{
    string originSite = req.Headers["Origin"];
    req.HttpContext.Response.Headers.Add("Access-Control-Allow-Origin", originSite);
    req.HttpContext.Response.Headers.Add("Access-Control-Allow-Credentials", "true");
    ....
 }

 

has anyone already had this problem? How to solve it?

Thank you very much

 

 

 

 

 

 

 

 

 

Andrea
Top achievements
Rank 1
Veteran
 asked on 19 Jan 2021
1 answer
1.1K+ views

The default selected color for my switch based on my theme is a reddish color.

I need to occasionally change that  on a particular page (blue) .  I do not want to change it for every page.

How can I target an individual switch element through css or property.

 

 

Any help would be appreciated.

 

Svetoslav Dimitrov
Telerik team
 answered on 19 Jan 2021
1 answer
674 views

 

We have an application (razorpages) that is currently using Telerik UI ASP.NET Core. We would successively like to upgrade it to be running Blazor Server-side.
Razorpages and Blazor is no problem mixing, but is it possible to both run Telerik UI ASP.NET Core and UI for Blazor within the same app but use different namespace imports within the pages?

I have failed installing both packages from nuget due to different versions in dependency-packages.

Marin Bratanov
Telerik team
 answered on 18 Jan 2021
1 answer
2.9K+ views
hi...would appreciate guidance on how to set max PopupHeight such that it will be auto until it hits a threshold px level of e.g. 200px after which the dropdown 'fixes' at that max height and becomes scrollable? many thanks
Nadezhda Tacheva
Telerik team
 answered on 15 Jan 2021
3 answers
704 views

While I've been able to customize the Sass-based themes using variables (https://docs.telerik.com/kendo-ui/styles-and-layout/sass-themes#using-variables), there are some customizations I've only been able to do by modifying the Kendo css classes.  For example, to remove the border from the grid pager, I had to override the .k-pager-wrap and .k-link classes:

.k-pager-wrap {
    .k-link {
        border-style: none
    }
}

The alternative is to create custom css classes:

<TelerikGrid Class="custom-class" />

However, I'd need to know the DOM structure to customize the pager element for that grid:

.custom-class {
    .div[data-role="pager"] {
        border-style: none
    }
}

My question is, how reliable is it to customize Kendo css classes or DOM elements?  Are there any guarantees that these css classes will not change and break our application with new Telerik releases?  If this is not a reliable approach, what are your recommendations?

Marin Bratanov
Telerik team
 answered on 15 Jan 2021
1 answer
197 views

I'm in the same situation as the OP in this post: https://www.telerik.com/forums/how-do-you-always-edit-series-when-editing-a-recurring-appointment


In my case, I'm working with with the Blazor Scheduler Component. How can I disable the prompt and automatically select "Edit the series"? Or at least "disable" the "Edit this occurrence" button when updating/deleting an appointment? 

Marin Bratanov
Telerik team
 answered on 14 Jan 2021
5 answers
630 views

Is it possible to have TreeView in one section of the Drawer and a ListView (with checkable items) in another section, similar to the attached image? I would like to have the ability to filter different tab contents using the same filter pane / drawer, that can be easily hidden or displayed

 

 

Nadezhda Tacheva
Telerik team
 answered on 13 Jan 2021
9 answers
1.3K+ views

Does anyone know of a way to force the ComboBox Popup to have an equal width to the ComboBox itself? My ComboBox doesn't have a fixed width like 300px because I am using it within a Bootstrap column. I have tried setting the Popup width to 100% but that makes it 100% of the whole page not 100% of the ComboBox width. There are some ways I can fudge the Popup width so that it is close to the ComboBox width, but I am looking for a way to have it always match the ComboBox width regardless of the ComboBox size.

 

Any help would be appreciated!

Ivan
Top achievements
Rank 3
Iron
Iron
Iron
 answered on 13 Jan 2021
4 answers
225 views

Hi. I have a TelerikTileLayout with 6 tiles.  5 of them use simple <TileLayoutItem HeaderText="..."> for the headings, but for one I need to use <HeaderTemplate>.

The text I add in the <HeaderTemplate> is not rendered the same size as the text I specify with HeaderText. Presumably I need to either add a span with a particular class, or some other element?

 

Anyone got this working?

Marin Bratanov
Telerik team
 answered on 13 Jan 2021
9 answers
2.0K+ views
01.
@if (_isLoading)
02.{
03.    <TelerikLoader Class="loader-indicator"
04.                   Type="@LoaderType.ConvergingSpinner"
05.                   Size="@LoaderSize.Large"
06.                   Visible="true"></TelerikLoader>
07.}
08.else
09.{
10.    <TelerikGrid Data="@_identities"
11.                 AutoGenerateColumns="true"
12.                 PageSize="50"
13.                 ScrollMode="@GridScrollMode.Virtual"
14.                 Height="460px"
15.                 RowHeight="60">
16.        <GridToolBar>
17.            <GridSearchBox />
18.        </GridToolBar>
19.    </TelerikGrid>
20.}
21. 
22.@code {
23.    List<IdentityDTO> _identities;
24.    public bool _isLoading { get; set; }
25. 
26.    protected override async Task OnInitializedAsync()
27.    {
28.        await LoadData();
29. 
30.    }
31.    async Task LoadData()
32.    {
33.        _isLoading = true;
34.        _identities = await _service.GetIdentities();
35.        _isLoading = false;
36.    }
37.}

 

Am I missing something basic here? Why wouldn't the loader be showing?

 

Nadezhda Tacheva
Telerik team
 answered on 12 Jan 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?