Telerik Forums
UI for Blazor Forum
1 answer
464 views

I have a Telerik Dialog:

 

@using Telerik.Blazor.Components
<TelerikDialog @bind-Visible="@Visible" Width="320px" Title="Submit the page">
    <DialogContent>
        <div id="dialog-form-fileupload">
            <div id="divMessagesFile" class="en-form-row en-message-warning">
            </div>
            <div class="col-md-12">
                <div class="form-group">
                    <InputFile OnChange="@LoadFiles">
                    </InputFile>
                </div>
                <div class="form-group">
                    <label>Documentsoort</label>
                    <div>
                        <TelerikDropDownList Data="@DocumentTypes" TextField="Value" ValueField="Key" @bind-Value="@DocumentType" @ref="@DocumentTypesRef"
                                             OnChange="OnDocumentTypeChanged"></TelerikDropDownList>
                    </div>
                    <div><span>@IsEnabled</span></div>
                </div>
                <div class="form-group">
                    <label>Meesturen naar aannemer</label>
                    <div class="form-check form-check-inline">
                        <TelerikCheckBox id="send-to-contractor" class="form-check-input" @bind-Value="@SentToContractor" Enabled="@IsEnabled" @ref="@SentToContractorRef" />
                    </div>
                </div>

            </div>
        </div>
    </DialogContent>
    <DialogButtons>
        <TelerikButton ButtonType="@ButtonType.Button" class="btn btn-primary ms-2" OnClick="@Save">Opslaan</TelerikButton>
        <TelerikButton ButtonType="@ButtonType.Button" class="btn btn-primary ms-2" OnClick="@Cancel">Annuleren</TelerikButton>
    </DialogButtons>
</TelerikDialog>

 

My problem is with the TelerikDropDownList and the TelerikCheckBox. In my OnDocumentTypeChanged I want to check/unchech and enable/disable the chekbox depending from the selected item in de dropdownlist.

I tried many ways but the checkbox did not change, i even put a span with the value of the IsEnabled, and also that didn't change.

However when I close the popup, and open it again, the values are correctly set
THis is the "close"function

private void Cancel()
    {
        Visible = false;
    }

These are the OnDocumentTypeChanged functions I used but did not work

 public void OnDocumentTypeChanged(object newValue)
    {
        var selectedItem = DocumentTypes.FirstOrDefault(item => item.Key == newValue as string);
        if (selectedItem != null)
        {
            IsEnabled = selectedItem.OpdrachtberichtWijzigbaar;
            SentToContractor = selectedItem.Opdrachtbericht;          
        }
        StateHasChanged();
    }

public async Task OnDocumentTypeChanged(object newValue)
    {
        var selectedItem = DocumentTypes.FirstOrDefault(item => item.Key == newValue as string);
        if (selectedItem != null)
        {
            IsEnabled = selectedItem.OpdrachtberichtWijzigbaar;
            SentToContractor = selectedItem.Opdrachtbericht;          
        }
        await InvokeAsync(StateHasChanged);

         return Task.CompletedTask;

    }

public async Task OnDocumentTypeChanged(object newValue)
    {
        var selectedItem = DocumentTypes.FirstOrDefault(item => item.Key == newValue as string);
        if (selectedItem != null)
        {
            await InvokeAsync(() =>
            {
                IsEnabled = selectedItem.OpdrachtberichtWijzigbaar;
                SentToContractor = selectedItem.Opdrachtbericht;
            });

            // Trigger a UI update
            StateHasChanged();
        }
    }

 

But I always get the same resutl, the checkbox' state is not changed only when i close the dialog and reopen it.

I also tried to close the dialog within the OnDocumentTypeChanged, by putting Visible = false; in it

And strangely, that did work, ANyone knows what I did wrong?

Hristian Stefanov
Telerik team
 answered on 17 Aug 2023
1 answer
340 views

Hi

We render a lot of charts with different sets of categories. We display the labels vertically and at an angle. Some have shorter names than others. This can make the charts appear differently and also move around as the label area expands and contracts. I will include an example picture.

Is a parameter like the Height parameter of ChartLegend available? I have not been able to find it so far. If I have missed it could someone point me in the right direction.

Just for context we have also:

  • truncated long names to certain lengths.
  • Attempted work arounds with padding vs label length but without a monospace font it is irregular

Thanks

 

Svetoslav Dimitrov
Telerik team
 answered on 17 Aug 2023
1 answer
210 views

Hello,

I would like to visualize moving objects on the map using Marker Layer on TelerikMap. The problem I have is that each refresh on the map resets the Center and Zoom parameters of the map to initial position. If I omit the Center and Zoom parameters of TelerikMap and initially manually zoom to my desired position - all works as expected. The user can move his view point on any place and observe the passing markers without reset to the starting view point. How can I set only initial zoom and center?

 


            <TelerikMap Height="300px" Center="@_center" Zoom="_zoom" @ref="_map">
                <MapLayers>
                    <MapLayer Type="@MapLayersType.Tile"
                              Attribution="@Attribution"
                              Subdomains="@Subdomains"
                              UrlTemplate="@UrlTemplate">
                    </MapLayer>

                    <MapLayer Type="MapLayersType.Marker"
                              Data="@_positions"
                              LocationField="@nameof(DeviceOnMap.LatLng)"
                              TitleField="@nameof(DeviceOnMap.Imei)" />
                </MapLayers>
            </TelerikMap>

    private async Task _moveTargets(CancellationToken token)
    {
        foreach (var report in reports)
        {
            double[] position = new double[] { report.Location.Coordinate.Y, report.Location.Coordinate.X };
            var device = _positions.Find(x => x.Imei == report.Device.Imei);
            if (device != null)
            {
                device.LatLng = position;
            }
            else
            {
                _positions.Add(new() { Imei = report.Device.Imei, LatLng = position });
            }
            await InvokeAsync(StateHasChanged);
            await Task.Delay(200, token);
        }
    }


Plamen
Top achievements
Rank 1
Iron
 answered on 16 Aug 2023
1 answer
563 views

I have a grid that has a couple of dateonly fields.  There can be dates or null for the data supplying the information.  Which ends up looking like this:

 

I would rather see blank than 1/1/0001, but I am not sure how to do this.

Here is the code for the grid:


<TelerikGrid TItem="EngineModel"
             Data="@EngineShowList"
             EditMode="@GridEditMode.Inline"
             OnEdit="@EditHandler"
             OnUpdate="@UpdateHandler"             
             @ref="@Grid">

      <GridColumns>
        <GridColumn Field="ProductionLine.EffectiveGuid" Title="EffectiveGuid" FieldType="@typeof(Guid)"     Editable="false" Visible="false" />
        <GridColumn Field="ProductionLine.EffectiveFrom" Title="From" FieldType="@typeof(DateOnly)" Editable="true" Width="20%">
            <EditorTemplate>
                <TelerikDatePicker Id="EffFromDate"
                    @bind-Value="@SelectedFromDate"
                    DebounceDelay="250"
                    Min="@Min"
                    Max="@Max">
                </TelerikDatePicker>
            </EditorTemplate>
        </GridColumn>

 

How would I get the display to just show blank for 1/1/0001?

 

Thanks!

Hristian Stefanov
Telerik team
 answered on 15 Aug 2023
1 answer
183 views

Hello,

I'm using the (excellent) TelerikUpload component in our Blazor app and I'm trying to set the initial files list for previously-uploaded files as specified here: https://docs.telerik.com/blazor-ui/components/upload/initial-files . When I try to do something like

Uploader.Files = new List<UploadFileInfo>();

I get the error that 'TelerikUploadBase<UploadFileInfo>.Files' is inaccessible due to its protection level.

If I try to set it as a parameter on the component declaration on my page, I get the error that Files isn't set a a ParameterAttribute or CascadingParameter.

Am I missing something?

Dimo
Telerik team
 answered on 15 Aug 2023
1 answer
181 views
The SplitButton Demo shows how to create a SplitButton with a fixed collection of SplitButtonItems, in that case for "Paste Text", "Paste as HTML", and "Paste Markdown".  I need to have a dynamic collection of SplitButtonItems.

A common example of this is the undo split button found in many applications such as Visual Studio or Microsoft Word.  Clicking the undo icon undoes one step of actions.  Or you can click the dropdown and select a step to go back to.  The list of options grows in size and changes, based on user actions.
Hristian Stefanov
Telerik team
 answered on 15 Aug 2023
1 answer
637 views

I'm using the Blazor Tooltip inside Scheduler ItemTemplates.  The content of my Tooltips is defined inside a Template.

Intermittently, the tooltip is flickering very fast as the mouse hovers between Scheduler events. I've not observed any patterns to the flickering behavior, as it sometimes ceases entirely.

In the past, when using Javascript to render rich content in tooltips, I've added a delay, but that doesn't appear to be an option with this control.

Any recommendations or workarounds to address this behavior?

Hristian Stefanov
Telerik team
 answered on 15 Aug 2023
1 answer
303 views

I have this TelerikDatePicker

<TelerikDatePicker @bind-Value="@WensDatum"

                                                       Format="dd-MM-yyyy"
                                                       Placeholder=""
                                                       id="wensdatum"></TelerikDatePicker>

 

private DateTime? WensDatum;

 

But when the user clicks on the DatePicker textbox, the Date Format is shown.

I would like that when the user clicks on the text box it stays empty. But I haven't found a solution for that.

Is this possible?

Hristian Stefanov
Telerik team
 answered on 14 Aug 2023
1 answer
224 views

Telerik.UI.for.Blazor Version=4.4.0

When TelerikDatePicker ReadOnly parameter is set to true, arrow keys can still be used to increment date values. For example with the year portion of a date selected one can press the up and down keys to increment and decrement the year. Typing a numeric value is prevented and the calendar popup is also prevented and functions as expected.

I did a check to see that the rendered input tag contains the readonly attribute, it is there. Looks like the arrow keys are handled outside of normal input tag behavior.

I have not checked the TelerikDateTimePicker or related components, but they may have the same issue.

Yanislav
Telerik team
 answered on 11 Aug 2023
2 answers
128 views

Hi,

the DragClueField always shows 'null' when dragging multiple objects instead of just one.

When only one item is dragged it shows the specified attribute but when it's two or more objects from a grid it salways shows 'null'.

Are you aware of this bug?

Dimo
Telerik team
 answered on 11 Aug 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?