Telerik Forums
UI for Blazor Forum
1 answer
46 views

I am working on a Blazor Auto application using the Upload component to upload images for a product for various properties in a SaaS type system.

I found that when I adjust the save point in the application at runtime the SaveUrl does not seem to retain the value.

For example:


SaveImageUrl = $"api/property/{TenantSelectionService.SelectedTenant.Id}/product-types/{TypeCode}/images";

<TelerikUpload AllowedExtensions="@(new List<string>() {".jpg", ".jpeg", ".webp" })"
                   SaveUrl="@SaveImageUrl"
                   WithCredentials="true"
                   OnUpload="@OnUploadAsync">

This is set in two locations, OnAfterRender as well as OnTenantSelectionChanged event.

When using this method, it appears that the Upload component does not retain the SaveUrl for some reason. When examining the JavaScript, the URL is always blank.  

I did manage to alter the URL to a static version and pass data as a header.

Is this something that can be looked into or maybe I am doing it wrong.

Dimo
Telerik team
 answered on 10 Oct 2024
1 answer
43 views
Is it possible to define a template for the Scheduler Grouping elements? I can't see anything in the docs for this.

I want to change the background colour and, if possible, include an image.

This is the section of the control I am talking about:

Hristian Stefanov
Telerik team
 answered on 09 Oct 2024
1 answer
67 views

Hi,

We've implemented group load on demand in a grid and the rows in each group are editable. Is is possible to maintain the expanded state of a group after a row has been edited?

I've amended the code in Toggle Group Load Mode at Runtime to show an example of the issue we have.

 

@using Telerik.DataSource

<p>
    <label>
        <TelerikCheckBox Value="@GridLoadGroupsOnDemand"
                         ValueChanged="@GridLoadGroupsOnDemandChanged"
                         TValue="@bool" /> Load Groups On Demand
    </label>
</p>

<TelerikGrid @ref="@GridRef"
             Data="@GridData"
             TItem="@Employee"
             Pageable="true"
             Sortable="true"
             Groupable="true"
             LoadGroupsOnDemand="@GridLoadGroupsOnDemand"
             FilterMode="GridFilterMode.FilterRow"
             OnStateInit="@OnGridStateInit"
             EditMode="@GridEditMode.Inline">
    <GridColumns>
        <GridColumn Field="@nameof(Employee.Name)" />
        <GridColumn Field="@nameof(Employee.Team)" />
        <GridColumn Field="@nameof(Employee.Salary)" />
        <GridColumn Field="@nameof(Employee.OnVacation)" />
                    <GridCommandColumn>
                <GridCommandButton Command="Save" Icon="@SvgIcon.Save" ShowInEdit="true">Update</GridCommandButton>
                <GridCommandButton Command="Edit" Icon="@SvgIcon.Pencil">Edit</GridCommandButton>
                <GridCommandButton Command="Cancel" Icon="@SvgIcon.Cancel" ShowInEdit="true">Cancel</GridCommandButton>
            </GridCommandColumn>
    </GridColumns>
</TelerikGrid>

@code {
    private TelerikGrid<Employee>? GridRef { get; set; }

    private List<Employee> GridData { get; set; } = new();

    private bool GridLoadGroupsOnDemand { get; set; }

    private void GridLoadGroupsOnDemandChanged(bool newValue)
    {
        GridLoadGroupsOnDemand = newValue;

        GridRef?.Rebind();
    }

    private void OnGridStateInit(GridStateEventArgs<Employee> args)
    {
        args.GridState.GroupDescriptors = new List<GroupDescriptor>();

        args.GridState.GroupDescriptors.Add(new GroupDescriptor()
        {
            Member = nameof(Employee.Team),
            MemberType = typeof(string)
        });
    }

    protected override void OnInitialized()
    {
        var rnd = new Random();

        for (int i = 1; i <= 20; i++)
        {
            GridData.Add(new Employee()
            {
                Id = i,
                Name = "Name " + i,
                Team = "Team " + (i % 4 + 1),
                Salary = (decimal)rnd.Next(1000, 3000),
                OnVacation = i % 3 == 0
            });
        }
    }

    public class Employee
    {
        public int Id { get; set; }
        public string Name { get; set; } = string.Empty;
        public string Team { get; set; } = string.Empty;
        public decimal Salary { get; set; }
        public bool OnVacation { get; set; }
    }
}

Dimo
Telerik team
 answered on 09 Oct 2024
1 answer
93 views

We currently have a legacy MVC application that we want to migrate to Blazor WebAssembly.

One of our problems is that, when using navigation to route to a MVC page via NavigationManager (which is done everywhere by Telerik UI), Blazor WebAssembly routes internally to NotFound. We would like to override that behaviour but are facing some issues:

1. We tried overriding the Telerik UI behaviour by overriding the onselect handler on some components (i.e. Drawer). While that works fine not every component that does routing seems to have a corresponding overridable event.

2. We tried overriding the navigation event globally using NavigationManager.RegisterLocationChangingHandler to cancel the navigation event and emit a new one (with forceLoad set to true). This seems to not work. Here is the code of our handler. It is getting called and the event is also cancelled just fine. It just seems that the forceLoad does not get respected in that case:

private ValueTask OnLocationChanging(LocationChangingContext context)
{
    if (BlazorPages.Internal.Contains(context.TargetLocation))
    {
        return ValueTask.CompletedTask;
    }

    if (Uri.TryCreate(context.TargetLocation, UriKind.Absolute, out Uri? _))
    {
        return ValueTask.CompletedTask;
    }

    context.PreventNavigation();

    NavigationManager.NavigateTo(context.TargetLocation, forceLoad: true);

    return ValueTask.CompletedTask;
}

3. We tried using anchor tags for routing. While that works fine it is really much work to implement this into every component that is getting used. While components can be made reusable we'd have to re-template some others every time since you can't just copy-paste them from the source project. There is not just that problem but also that anchor tags break the styling at every component that I tried until now and we have to style them correctly which also consumes much time.

 

So, the question here is: What is the correct way to handle this use case? Do we really have to rewrite most components that include anchor tags? Is there maybe an alternating Telerik UI version that actually uses anchor tags instead of programmatical routing (which would be really nice since we would get things like right click to open new tab features)?

Dimo
Telerik team
 answered on 08 Oct 2024
0 answers
58 views

I am trying to use a Telerik MultiSelect to allow the user to select multiple values with filtering, however with my initial implementation I am stumbling into an odd error where the first select item basically "prevents" scrolling.

 

 

As you can see from above, I select the first item, but then no matter if I use my scroll wheel or the vertical scroller on the side, the component automatically snaps back to the selected item being in focus..

 

I am running the latest Telerik.UI.for.Blazor 6.2.0 and this project is a Blazor Maui app running .Net 8.0.. 

Erik
Top achievements
Rank 1
 asked on 04 Oct 2024
1 answer
97 views
I`m looking to improve the UX around the Editor Component and to incorporate grammar/rewrite capabilities. It seems Telerik Components are bit light when it comes to AI integration and don`t see anything on the roadmap either.

For comparison Syncfusion have a whole set of integrations (Introducing the AI-Powered Smart Blazor Components and Features (syncfusion.com)) and specifically one for their Editor which gives it grammar/rewrite/summarisation capabilities.

All I`ve found from Telerik is the AI Prompt which is only useful if you`re looking for a chatbot experience. 
Dimo
Telerik team
 updated answer on 04 Oct 2024
1 answer
94 views

I don't like the "Default" behavior of adding items to TelerikScheduler ... there is NO visible UI cue for users on how to add an item to the schedule ... they have to be told to double click on a day, this is bad UI design.

I realize I can just create my own Add button and manage adding of schedule items.  BUT, I was wondering if Telerik offered a custom Add option either with the OnCreate or something else?  Something along the lines of how Add is supported in TelerikGrid with GridToolBarTemplate and GridCommandButton??

Rob.

Nansi
Telerik team
 answered on 04 Oct 2024
1 answer
86 views

I'm a newbie about to try putting a carousel in my first app.  I notice, however, that when the carousel loops back to the beginning, the visual appearance truly is of going back to the beginning.  Is there an easy way to make it look, instead, like it's an endless loop?  Obviously the buttons would betray the truth, but the images would appear to move forward continuously.

Thanks!

Hristian Stefanov
Telerik team
 answered on 04 Oct 2024
1 answer
69 views
  1. 1how i disable context menu in telerik pdfviewer
  2. how i disable text selection  or copying

 

Hristian Stefanov
Telerik team
 answered on 03 Oct 2024
1 answer
109 views

Hello there,

I am using the Telerik Predefined Dialogs for several different uses, and I want to add the x Close icon in the upper right corner. I know it's redundant, but it's a project requirement and it also seems to be best practice for UI/UX.

if (DisclosureReportSelections.ActivitySelection == -1)
        {
            await Dialogs.AlertAsync("Activity must be reported for this period.", "Report Information Required");
            return false;
        }

I like the Predefined Dialogs because they provide 'await' for the user's response, which is handy and efficient in code. I do not want the hassle of customizing a standard Dialog while managing it's visible state.

Attached image for reference.

Hristian Stefanov
Telerik team
 answered on 02 Oct 2024
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?