Hi all,
Could you please add the OnBeforeActiveTabIndexChange event and allow to cancel ActiveTabIndexChange in the handler?
I saw an example in the doc about how to prevent tab (index) change, but it is not sufficient because of:
- event if you won't change the tab index, the active tab is still being destroyed and recreated;
- we don't want to keep the tab in memory by using the Persist flag;
We need to prevent tab switching by showing the user a confirmation and reacting to the user's choice.
I have the following code for my GridToolBarTemplate. We want the ExportToExcel formated to the far right while the Resub, Cancel and Cleare stay to the left. How is this done?
<GridToolBarTemplate>
<GridCommandButton Command="Resubmit" Enabled="@IsResubmitEnabled" Icon="@SvgIcon.Redo" OnClick="TransactionsGrid_ResubmitButton_ClickAsync">RESUBMIT</GridCommandButton>
<GridCommandButton Command="Cancel" Icon="@SvgIcon.Cancel" OnClick="TransactionsGrid_CancelButton_Click">CANCEL</GridCommandButton>
<GridCommandButton Command="Clear" Icon="@SvgIcon.ArrowRotateCcw" OnClick="TransactionsGrid_ClearButton_Click">CLEAR</GridCommandButton>
<GridCommandButton Command="ExcelExport" Icon="@SvgIcon.FileExcel">Export to Excel</GridCommandButton>
</GridToolBarTemplate>
See that popup hint when the user has eht emouse over the draweritem, [Products], had this working fine in the net6 version of the app. But on converting to .net8 it appears to have stopped working.
Do I need to do somethign different? I cant find any simple examples of gettign this to work.
Code I have:
@inject NavigationManager NavigationManager
<TelerikTooltip TargetSelector=".k-drawer-items span.k-icon[title]" />
<div class="drawer-container">
<div class="custom-toolbar">
<TelerikButton OnClick="@ToggleDrawer"
Icon="@FontIcon.Menu"
FillMode="@(ThemeConstants.Button.FillMode.Flat)">
</TelerikButton>
<span class="mail-box">@strAppName</span>
</div>
<TelerikDrawer @ref="@Drawer"
Data="Data"
MiniMode="true"
Mode="@DrawerMode.Push"
TItem="DrawerItem"
SelectedItemChanged="@OnItemSelect"
@bind-Expanded="@Expanded">
<Template>
<div class="k-drawer-items" role="menubar" aria-orientation="vertical">
<ul>
@foreach (var item in context)
{
var selectedClass = item == SelectedItem ? "k-selected" : string.Empty;
<li @onclick="@(() => OnItemSelect(item))" class="k-drawer-item @selectedClass k-level-@(item.Level)">
<TelerikSvgIcon Icon="@item.Icon"></TelerikSvgIcon>
<span class="k-item-text">@item.Text</span>
<span class="k-icon k-font-icon k-i-@item.Icon" title="@item.Title"></span>
@if (item.Expanded && (item.Children?.Any() ?? false))
{
<TelerikSvgIcon Class="drawer-chevron-icon" Icon="@SvgIcon.ChevronDown" />
}
else if (!item.Expanded && (item.Children?.Any() ?? false))
{
<TelerikSvgIcon Class="drawer-chevron-icon" Icon="@SvgIcon.ChevronRight" />
}
</li>
}
</ul>
</div>
</Template>
</TelerikDrawer>
</div>
<style>
.sidebar {
background-image: none !important;
}
.drawer-container {
/* margin: 30px auto;*/
width: 100% !important; /*100%*/
}
.k-drawer-container {
position: relative;
width: 100%;
}
.custom-toolbar {
width: @strAppNameWidth;
background-color: #f6f6f6;
line-height: 49px;
border-bottom: inset;
border-bottom-width: 1px;
padding: 3px 8px;
color: #656565;
}
.mail-box {
margin-left: 20px;
font-weight: bold;
font-size: 17px;
}
.page ul {
list-style: none;
margin: 0;
padding: 0;
}
.page li:last-child {
border: 0;
}
.page li h6 {
border-bottom: none;
padding-bottom: 8px;
}
.k-drawer-content {
padding: 25px;
font-size: 18px;
}
.k-d-level {
display: flex;
}
.drawer-chevron-icon {
position: absolute;
right: 0;
line-height: inherit;
margin: 0 8px
}
</style>
As far as I can tell this line: <span class="k-icon k-font-icon k-i-@item.Icon" title="@item.Title"></span>
Should be doing the work of showing the Hint whcih I am putting in title in code behind.
example:
new List<DrawerItem>
{
new DrawerItem
{
Title = "Home",
Text = "Home",
Icon = SvgIcon.Home,
Url="./"
},
new DrawerItem
{
Title = "Management",
Text = "Management",
Icon = SvgIcon.DataSds,
Url="Management"
},
new DrawerItem
{
Title = "Products",
Text = "Products",
Icon = SvgIcon.BuildingBlocks,
Url="Products"
},
Any suggestions pointers as to what I am doing incorrectly?
Thanks
Deasun.
I'm currently trying to integrate telerik tilelayout inside telerik tabstrip dynamically?
for example
<TabStripTab Class="@(filteredRows.Any() ? GetTabWidth() : "auto")" Title="@tabtitle1["tabtitle"].ToString()">
<TelerikTileLayout Columns="12"
RowHeight="auto"
Resizable="true"
Reorderable="true">
<TileLayoutItems>
@foreach (DataRow row in filteredRows)
{
<_Data columnspan='Convert.ToInt32(row["columnspan"])' rowspan='Convert.ToInt32(row["rowspan"])' pageId="@pageId" oDt="row" encryptQueryString="@data"></_Data>
}
</TileLayoutItems>
</TelerikTileLayout>
</TabStripTab>
}
@if (filteredRows2.Any())
{
<TabStripTab Title="@tabtitle2["tabtitle"].ToString()">
<TelerikTileLayout Columns="12"
RowHeight="auto"
Resizable="true"
Reorderable="true">
<TileLayoutItems>
@foreach (DataRow row in filteredRows2)
{
<_Data columnspan='Convert.ToInt32(row["columnspan"])' rowspan='Convert.ToInt32(row["rowspan"])' oDt="row" data="@data"></_Data>
}
</TileLayoutItems>
</TelerikTileLayout>
</TabStripTab>
when i set persist content to true it reloads the components which invoke the database calling ?I s there any way to do without component being refreshed?
Hi, I'm trying to create a new project using the telerik blazor project template. When I click the Create button, VS hangs and nothing is created.
Using:
DOTNET 8
Microsoft Visual Studio Community 2022 (64-bit) - Current
Version 17.10.5
Telerik Blazor 6.1.0
Thanks
Hello,
I'm receiving an exception after I upgraded to version 6.0.2. When I try to load a GroupDescriptor on StateInit of a grid, the page crashes. It seems like if the OnRead method is async and takes too long, it causes something to be null and throws a null argument exception. Here's an example for the error:
fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
Unhandled exception in circuit 'DlYqtxkSjOU4QLgOZWeNdQC1Z5gG3bJP4QfPcowK3-w'.
System.ArgumentNullException: Value cannot be null. (Parameter 'source')
at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Linq.Enumerable.Select[TSource,TResult](IEnumerable`1 source, Func`2 selector)
at Telerik.Blazor.Components.TelerikGrid`1.SetProcessedGroups(IEnumerable data)
at Telerik.Blazor.Components.TelerikGrid`1.SetProcessedData(IEnumerable data)
at Telerik.Blazor.Components.Common.DataBoundComponent`1.ProcessOnReadResult(ReadEventArgs args)
at Telerik.Blazor.Components.Common.GridBase`1.<>n__0(ReadEventArgs args)
at Telerik.Blazor.Components.Common.GridBase`1.ProcessOnReadResult(ReadEventArgs args)
at Telerik.Blazor.Components.Common.DataBoundComponent`1.ProcessOnReadData()
at Telerik.Blazor.Components.Common.DataBoundComponent`1.StartDataProcessAsync()
at Telerik.Blazor.Components.Common.DataBoundComponent`1.ProcessDataOnParametersSetAsync()
at Telerik.Blazor.Components.Common.DataBoundComponent`1.OnParametersSetAsync()
at Telerik.Blazor.Components.TelerikGrid`1.OnParametersSetAsync()
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
This was working fine when I was using version 5.1.1, but broke when I tried to upgrade to 6.0.2. I added a simplified example to reproduce the error I'm experiencing. I'm running the App in "Server" render mode in case that's relevant.
Test code:
_Host.cshtml...
<component type="typeof(App)" render-mode="Server" />
...
Test.razor
@page "/"
@using Telerik.DataSource
@using Telerik.DataSource.Extensions;
<div class="k-d-flex-col k-justify-content-center">
<TelerikGrid @ref="GridRef" TItem="Employee" Groupable="true" Pageable="true" Height="400px" OnRead="@ReadAsync" OnStateInit="@StateInit">
<GridAggregates>
<GridAggregate Field="Team" Aggregate="@GridAggregateType.Count" />
</GridAggregates>
<GridColumns>
<GridColumn Field=@nameof(Employee.Name) Groupable="false" />
<GridColumn Field=@nameof(Employee.Team) Title="Team" />
<GridColumn Field=@nameof(Employee.IsOnLeave) Title="On Vacation" />
</GridColumns>
</TelerikGrid>
</div>
@code {
public TelerikGrid<Employee> GridRef { get; set; }
public async Task ReadAsync(GridReadEventArgs args)
{
var data = new List<Employee>();
var rand = new Random();
for (int i = 0; i < 50; i++)
{
data.Add(new Employee()
{
EmployeeId = i,
Name = "Employee " + i.ToString(),
Team = "Team " + i % 5,
IsOnLeave = i % 2 == 0
});
await Task.Delay(50); // simulating DB call
}
DataSourceResult result = await data.ToDataSourceResultAsync(args.Request);
args.Data = result.Data;
args.Total = result.Total;
args.AggregateResults = result.AggregateResults;
}
public void StateInit(GridStateEventArgs<Employee> args)
{
args.GridState.GroupDescriptors = new List<GroupDescriptor>()
{
new GroupDescriptor()
{
Member = "Team",
MemberType = typeof(string)
}
};
}
public class Employee
{
public int EmployeeId { get; set; }
public string Name { get; set; }
public string Team { get; set; }
public bool IsOnLeave { get; set; }
}
}
Any help would be appreciated.
Hi, I'm trying to install the UI for Blazor package to a project and it wont install. I get the following message:
---------
-------
this is my csproj file is
<Project Sdk="Microsoft.NET.Sdk.Web">
Visual Studio is version is 17.10.5
Telerik UI is 6.0.2
Thanks
Hi there,
Is there any way to edit/modify the first column? I mean, I would like to add some button, image, etc to the column. Like i show in the next image. There's any template to recreate this behavior ?
Here's some code from that example.
Thanks in advance.
@page "/schedulerTelerik"
<div class="container">
<div class="d-flex justify-content-between gap-4">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Change start date:</span>
</div>
<TelerikDateTimePicker @bind-Value="@startDate" Class="form-control" />
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Change end date:</span>
</div>
<TelerikDateTimePicker @bind-Value="@endDate" Class="form-control" />
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Change slot duration:</span>
</div>
<TelerikNumericTextBox @bind-Value="@slotDuration" Class="form-control" />
</div>
</div>
<br />
<TelerikScheduler Data="@appointments" @bind-Date="@startDate" @bind-View="@currentView" Height="800px"
AllowCreate="true" AllowDelete="true" AllowUpdate="true">
<SchedulerViews>
<SchedulerTimelineView StartTime="@startTime" EndTime="@endTime"
SlotDuration="@slotDuration"
SlotDivisions="@slotDivision"
ColumnWidth="@columnWidth" />
</SchedulerViews>
<SchedulerResources>
<SchedulerResource Field="Team" Title="Edit team" Data="@schedulerResources"></SchedulerResource>
</SchedulerResources>
<SchedulerSettings>
<SchedulerGroupSettings Resources="@groupingResources" Orientation="@SchedulerGroupOrientation.Vertical"></SchedulerGroupSettings>
</SchedulerSettings>
</TelerikScheduler>
</div>
using Telerik.Blazor;
using Telerik.FontIcons;
namespace TelerikComponentsTest.Pages
{
public partial class SchedulerTelerik
{
#region Auxiliar classes
public class SchedulerAppointment
{
public Guid Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public DateTime Start { get; set; } = DateTime.Now;
public DateTime End { get; set; } = DateTime.Now.AddHours(4);
public bool IsAllDay { get; set; }
public string RecurrenceRule { get; set; }
public List<DateTime> RecurrenceExceptions { get; set; }
public Guid? RecurrenceId { get; set; }
public FontIcon? Icon { get; set; }
public SchedulerAppointment()
{
Id = Guid.NewGuid();
}
}
public class Resource
{
public string Text { get; set; }
public string Value { get; set; }
public string Color { get; set; }
}
#endregion
#region Dependency injection services
// the following static classes mimics an actual data service that handles the actual data source
// replace it with your actual service through the DI, this only mimics how the API can look like and works for this standalone page
public static class MockupAppointmentService
{
private static List<SchedulerAppointment> _data { get; set; } = new List<SchedulerAppointment>();
public static async Task CreateAppointmentAsync(SchedulerAppointment itemToInsert)
{
itemToInsert.Id = Guid.NewGuid();
_data.Insert(0, itemToInsert);
}
public static async Task<List<SchedulerAppointment>> ReadAppointmentAsync() => await Task.FromResult(_data);
public static async Task UpdateAppointmentAsync(SchedulerAppointment itemToUpdate)
{
var index = _data.FindIndex(i => i.Id == itemToUpdate.Id);
if (index != -1)
{
_data[index] = itemToUpdate;
}
}
public static async Task DeleteAppointmentAsync(SchedulerAppointment itemToDelete)
{
if (itemToDelete.RecurrenceId != null)
{
// a recurrence exception was deleted, you may want to update
// the rest of the data source - find an item where theItem.Id == itemToDelete.RecurrenceId
// and remove the current exception date from the list of its RecurrenceExceptions
}
if (!string.IsNullOrEmpty(itemToDelete.RecurrenceRule) && itemToDelete.RecurrenceExceptions?.Count > 0)
{
// a recurring appointment was deleted that had exceptions, you may want to
// delete or update any exceptions from the data source - look for
// items where theItem.RecurrenceId == itemToDelete.Id
}
_data.Remove(itemToDelete);
}
}
public static class MockupResourcesService
{
public static List<Resource> _resources { get; set; } = new List<Resource>() {
new Resource()
{
Text = "Alex",
Value = "1",
Color = "#99ffcc"
},
new Resource()
{
Text = "Bob",
Value = "2",
Color = "#47d147"
},
new Resource()
{
Text = "Charlie",
Value = "3",
Color = "#336600"
}
};
public static async Task<List<Resource>> GetResourcesAsync() => await Task.FromResult(_resources);
}
#endregion
#region Fields
private DateTime
startDate = DateTime.Now.Date,
endDate = DateTime.Now.Date.AddDays(1).AddHours(10),
startTime= DateTime.Now.Date,
endTime= DateTime.Now.Date.AddHours(23);
private int
slotDuration = 60,
slotDivision = 1,
columnWidth = 80;
private List<Resource> schedulerResources = new List<Resource>();
private List<SchedulerAppointment> appointments = new();
private List<string> groupingResources = new List<string> { "Team" };
private SchedulerView currentView = SchedulerView.Timeline;
#endregion
#region private methods
private void GetSchedulerData() => appointments = new List<SchedulerAppointment>();
private async Task GetResources() => schedulerResources = await MockupResourcesService.GetResourcesAsync();
#endregion
#region Life time cycle
protected override async Task OnInitializedAsync()
{
GetSchedulerData();
await GetResources();
await base.OnInitializedAsync();
}
#endregion
}
}
I have a grid that I built on Radzen Studio is there any way for me to convert into telerik.
Here is my code
Filename: IqdateIqdates.razor.cs
using System;Filename: IqdateIqdates.razor
and here is my model file
using System;@page "/telerik-enum-dropdown"
@using Telerik.Blazor.Components
<div class="form-group">
<label for="telerikDropDown">Delivery Week</label>
<TelerikDropDownList Data="@deliveryWeeks"
@bind-Value="@selectedDeliveryWeek"
Id="telerikDropDown"
TextField="Text"
ValueField="Value">
</TelerikDropDownList>
</div>
@code {
private string selectedDeliveryWeek;
private List<DropDownItem> deliveryWeeks;
protected override void OnInitialized()
{
deliveryWeeks = Enum.GetValues(typeof(DeliveryWeek))
.Cast<DeliveryWeek>()
.Select(dw => new DropDownItem
{
Text = dw.ToString(),
Value = dw.ToString()
}).ToList();
}
public class DropDownItem
{
public string Text { get; set; }
public string Value { get; set; }
}
public enum DeliveryWeek
{
Week1,
Week2,
Week3,
Week4,
Week5
}
}