Hi
I want to use the TelerikMenu so I'm trying to create a list of menu items to pass to the Data property
<TelerikMenu Data=menuItems>
</TelerikMenu>
List<MenuItem> menuItems;
and I'm getting an error: "Using the generic type 'MenuItem<TItem>' requires 1 type arguments"
but in the docs, I see it'd be used without a generic parameter: https://docs.telerik.com/blazor-ui/components/menu/overview
Thanks
I have a listbox where I feed a default value into the class in the url. I am able to populate the bound SelectedItems value but it doesn't highlight the selected value in the control. How do I do this?
<TelerikListBox Data="@SessionOptionTemplates" Width="350px"
SelectionMode="ListBoxSelectionMode.Single"
TextField="@nameof(SessionOptionTemplate.Name)"
OnReorder="@((ListBoxReorderEventArgs<SessionOptionTemplate> args) => OnReorderSessionOptionTemplates(args))"
OnRemove="@((ListBoxRemoveEventArgs<SessionOptionTemplate> args) => OnRemoveSessionOptionTemplates(args))"
SelectedItemsChanged="@((IEnumerable<SessionOptionTemplate> selectedTemplates) => OnSelectedSessionOptionTemplate(selectedTemplates))">
<ListBoxToolBarSettings>
<ListBoxToolBar Visible="true">
<ListBoxToolBarMoveUpTool />
<ListBoxToolBarMoveDownTool />
<ListBoxToolBarRemoveTool />
<ListBoxToolBarCustomTool>
<TelerikButton Icon="@SvgIcon.DetailSection"
Enabled="@( SelectedSessionOptionTemplate != null )"
OnClick="@ShowEditDialogSessionOptionTemplates" />
</ListBoxToolBarCustomTool>
</ListBoxToolBar>
</ListBoxToolBarSettings>
</TelerikListBox>
public async Task OnSelectedSessionOptionItem(
IEnumerable<SessionOptionItem> selectedItems)
{
if (selectedItems.Any())
{
SessionOptionItem selectedItem =
selectedItems.FirstOrDefault(x =>
x.Id == selectedItems.First().Id);
if (selectedItem != null)
{
SelectedSessionOptionItems =
new List<SessionOptionItem>()
{
selectedItem
};
}
}
await Task.CompletedTask;
}
public async Task OnSelectedSessionOptionTemplate(
IEnumerable<SessionOptionTemplate> selectedItems)
{
if (selectedItems.Any())
{
SessionOptionTemplate selectedItem =
selectedItems.FirstOrDefault(x =>
x.Id == selectedItems.First().Id);
if (selectedItem != null)
{
SelectedSessionOptionTemplates =
new List<SessionOptionTemplate>() { selectedItem };
SessionOptionItemClient.AccessToken = AccessToken;
SessionOptionItemClient.CustomerUniqueId = CustomerUniqueId;
var itemResponse =
await SessionOptionItemClient.GetBySessionOptionTemplateIdAsync(
selectedItem.Id);
if (itemResponse != null &&
itemResponse.IsSuccess &&
itemResponse.Result != null)
{
SessionOptionItems =
itemResponse.Result.OrderBy(x => x.Order).ToList();
if (SessionOptionItems.Any())
{
await OnSelectedSessionOptionItem(
new List<SessionOptionItem>() { SessionOptionItems.First() });
}
}
else
{
SessionOptionItems = null;
}
}
}
}
private IEnumerable<SessionOptionTemplate> SelectedSessionOptionTemplates { get; set; } =
new List<SessionOptionTemplate>();
Hello, I am developing a blazor application using telerik components and i am facing a problem, every 25 minutes during user operations, the application has refreshed and navigated to home page. Is there a parameter in blazor or telerik is affecting the behaviour. I need to avoid this action.
I am studying the Telerik controls for Blazor, so I've created the following REPL with code found on the docs:
https://blazorrepl.telerik.com/GSuFlZQa06BKC3Xn51
On the REPL everything works perfectly, but when I create a project and use the same code, the fields for the properties Id, FirstName and LastName don't get the values set on code.
Also, the button on the TelerikDatePicker does not work, but I don't know if the two problems are related.
I am attaching a sample project to reproduce the behavior.
Hello there,
I am trying to load the Gantt Chart - Tree List in expanded state by default. Is there a way to achieve this? Kindly advise. I am using the Telerik Blazor version 5.0.1. TIA
Hi:
I am trying to use my Telerik Blazor 4.3.0 with a new Blazor 8 WebApp Server Global project. I keep getting the error:
Microsoft.JSInterop.JSException: Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
at t (https://blazor.cdn.telerik.com/blazor/4.3.0/telerik-blazor.min.js:50:1034368)
Can you help me?
Thanks,
Roger
Hello,
I am looking to incorporate search functionality, multiselect, and grouping in Telerik MultiSelect. Additionally, I need to make API calls for every character entered during searching. Although the OnRead parameter in TelerikMultiSelect seems to provide these arguments, I have encountered difficulty achieving grouping in Telerik MultiSelect using this parameter.
Is there a way to obtain the SearchText inside a function whenever the user is typing, allowing me to make API calls? Alternatively, can I utilize the OnRead parameter in TelerikMultiSelect to achieve grouping, searching, and multiselect simultaneously?
I have managed to retrieve the search text from MultiSelectReadEventArgs args using OnRead, as shown below:
"dynamic item = args.Request.Filters.FirstOrDefault();
var searchText = (string)item.Value; "
The code for TelerikMultiSelect is as follows:
<TelerikMultiSelect Data="@Data"
@bind-Value="@SelectedProducts"
GroupField="Category.CategoryName"
TextField="ProductName"
ValueField="ProductId"
Placeholder="Select a product">
</TelerikMultiSelect>
@code {
public IEnumerable<Product> Data { get; set; }
public List<int> SelectedProducts { get; set; } = new List<int>();
protected override void OnInitialized()
{
List<Product> products = new List<Product>();
for (int i = 0; i < 20; i++)
{
products.Add(new Product()
{
ProductId = i,
ProductName = $"Product {i}",
Category = new Category() { CategoryId = i % 5, CategoryName = $"Category {i % 5}" }
});
}
Data = products;
base.OnInitialized();
}
public class Product
{
public int ProductId { get; set; }
public string ProductName { get; set; }
public Category Category { get; set; }
}
public class Category
{
public int CategoryId { get; set; }
public string CategoryName { get; set; }
}
}
Hello, I have a grid with
TelerikGrid Data="@lData" Height="200px" Width="auto" RowHeight="20" @ref="@GridRef"
Sortable="true" Navigable="true"
FilterMode="GetFilter()" Size="@ThemeConstants.Grid.Size.Small"
Resizable="true" Reorderable="true" SelectionMode="@GridSelectionMode.Single"
SelectedItemsChanged="@((IEnumerable<NodeData> list) => SelectRows(list))"
OnRowClick="@OnRowClickHandler"
OnRowDoubleClick="@OnRowDoubleClickHandler">
Problem is with selection in grid with calling await OnSelectRowCallback.InvokeAsync(selectRowrEventArgs);
I tried also OnRowClickHandler but seems the same problem. Could you help me, please, I don't know what is wrong
Thanks Peter
Hi
We have been using a form action to logout within our TelerikMenu:
<TelerikMenu Data="@MenuItems">
<ItemTemplate Context="item">
@{
if (item.IsForm)
{
<form method="post" action="@item. Action">
<AntiforgeryToken />
<input type="hidden" name="ReturnUrl" value="/" />
<input type="submit" value="@item. Text"/>
</form>
}
else
{
<NavLink href="@item.Url">
<span>@item.Text</span>
</NavLink>
}
}
</ItemTemplate>
</TelerikMenu>
But we are now struggling with the new `<AntiforgeryToken />`. It does not seem to be able to render itself. I don't know if it has anything to do with the way it constructs itself:
private void RenderField(RenderTreeBuilder builder)
{
builder.OpenElement(0, "input");
builder.AddAttribute(1, "type", "hidden");
builder.AddAttribute(2, "name", _requestToken!.FormFieldName);
builder.AddAttribute(3, "value", _requestToken.Value);
builder.CloseElement();
}
We have managed to create a work around by basically copying the AntiforgeryToken logic into our own component i.e.:
@inject AntiforgeryStateProvider antiforgeryStateProvider
<input type="hidden" name="@_requestToken!.FormFieldName"value="@_requestToken.Value" />
@code {
private AntiforgeryRequestToken? _requestToken;
??? (){
_requestToken = antiforgeryStateProvider?.GetAntiforgeryToken();
}
}
But this means that we would have to maintain that extra code and take on the responsibility of the security it provides. Is TelerikMenu the wrong component for this or is there any better way to get this working?
Thanks,
Mark
Can you confirm that Telerik UI for Blazor (3.7.0 Published Wednesday, November 9, 2022) is not using Microsoft System.Data.Common in such a way that it would expose the following risk to our system. Either way, can you confirm that upgrading to Telerik UI for Blazor V 5 would mitigate this? Thanks.
"CVE-2020-1147 is a remote code execution vulnerability that exists in .NET Framework, Microsoft SharePoint, and Visual Studio. This vulnerability can be exploited when the software fails to check the source markup of XML file input. An attacker who successfully exploits this vulnerability could run arbitrary code in the context of the process responsible for deserialization of the XML content.
In the context of Telerik, it’s important to note that the Telerik UI for ASP.NET AJAX builds before R1 2020 (2020.1.114) are vulnerable to this exploit. This vulnerability was exploited by multiple cyber threat actors, including an advanced persistent threat (APT) actor, in a .NET deserialization vulnerability (CVE-2019-18935) in Progress Telerik UI for ASP.NET AJAX, located in a federal civilian executive branch (FCEB) agency’s Microsoft Internet Information Services (IIS) web server."