I have defined a Combobox where the user can choose between various templates. After changing the Template (value in Combobox) a TelerikGrid will change the number/order of columns in the grid.
Depending on the defined column name (Name=="Spacer" via a conditional if) I will create one column differently. This will end up as an unexpected order of the columns. See order of columns in method CreateTemplates.
This is only a simple example, but I have more complex conditions for creating GridColumns depending on the data which I want to display.
What is wrong? My expectation is the TelerikGrid should display the column as defined in IList<Template> Templates
Razor Selection:
<div class="row">
<div class="column">
<label>
Template:
<select class="form-control col-12" @onchange="@OnSelectTemplate">
@foreach (var template in Templates)
{
if (template.Name == _selectedTemplate.Name)
{
<option value="@template.Name" selected>@template.Name</option>
}
else
{
<option value="@template.Name">@template.Name</option>
}
}
</select>
</label>
</div>
</div>
Razor Grid:
<TelerikGrid Data="@Data"
Pageable="false"
Resizable="true"
Sortable="false"
EditMode="@GridEditMode.Incell"
Width="1200px"
Height="600px"
OnUpdate="@UpdateHandler"
SelectionMode="@GridSelectionMode.Single">
<GridColumns>
@{
// Data is provided
if (Data != null && Data.Any())
{
// ....Fill Grid
}
else
{
// No Data provided
foreach (var column in ColumnList)
{
if (column.Name == "Spacer")
{
<GridColumn Field=""
Title="XXX"
Width="20px"
Resizable="false"
Editable="false"
Id="Spacer"/>
}
else
{
<GridColumn Id="@column.Name"
Field="@column.Name"
Title="@column.Caption"
Width="@(column.Width + $"px")"
Resizable="true"
FieldType="@typeof(string)"/>
}
}
}
}
</GridColumns>
</TelerikGrid>
Class Template:
public class Template
{
public string Name { get; set; }
public IEnumerable<TemplateColumn> Columns { get; set; }
public static IList<Template> CreateTemplates()
{
var result = new List<Template>()
{
new Template()
{
Name = "Template 1",
Columns = new List<TemplateColumn>()
{
new TemplateColumn()
{
Name = "ID",
Caption = "ID",
IsReadOnly = true,
Width = 80
},
new TemplateColumn()
{
Name = "Desc_EN",
Caption = "Description",
IsReadOnly = false,
Width = 250
},
new TemplateColumn()
{
Name = "Spacer",
Caption = "XXX",
IsReadOnly = true,
Width = 20
},
new TemplateColumn()
{
Name = "Desc_DE",
Caption = "Description german",
IsReadOnly = false,
Width = 250
},
}
},
new Template()
{
Name = "Template 2",
Columns = new List<TemplateColumn>()
{
new TemplateColumn()
{
Name = "ID",
Caption = "ID",
IsReadOnly = true,
Width = 80
},
new TemplateColumn()
{
Name = "Spacer",
Caption = "XXX",
IsReadOnly = true,
Width = 20
},
new TemplateColumn()
{
Name = "Desc_DE",
Caption = "Description german",
IsReadOnly = false,
Width = 250
},
new TemplateColumn()
{
Name = "Desc_EN",
Caption = "Description",
IsReadOnly = false,
Width = 250
},
}
}
};
return result;
}
}
Class TemplateColumn:
public class TemplateColumn
{
public string Name { get; set; }
public string Caption { get; set; }
public int Width { get; set; }
public bool IsReadOnly { get; set; }
}Additional Razor Code:
@code {
private List<BomItemDto> Data { get; set; } = new List<BomItemDto>();
private IList<Template> Templates { get; set; } = new List<Template>();
private Template _selectedTemplate;
public IList<TemplateColumn> ColumnList { get; set; } = new List<TemplateColumn>();
protected override async Task OnInitializedAsync()
{
var bomTemplates = Template.CreateTemplates();
Templates = bomTemplates.ToList();
_selectedTemplate = bomTemplates.FirstOrDefault();
ColumnList = _selectedTemplate.Columns.ToList();
}
private async Task OnSelectTemplate(ChangeEventArgs e)
{
var selectedTemplateName = e.Value.ToString();
_selectedTemplate = Templates.FirstOrDefault(p => p.Name == selectedTemplateName);
var columnList = _selectedTemplate.Columns.ToList();
ColumnList.Clear();
ColumnList = columnList;
}
private async Task UpdateHandler(GridCommandEventArgs args)
{
}
}
How can I make a Multiselect readonly?
I want to show a list of "chips" and this is very close to what I want:
<TelerikMultiSelect Data="@Values" Enabled="true" @bind-Value="@Values" ClearButton="true" AutoClose="false" MinLength="100000" />But I don't want the user to type anything. I can not set it to disabled because I want to be able to close the chips, so what I want is a readonly possibility. Is this possible to do?
I set a Grid to have the property FilterMode="@GridFilterMode.FilterMenu" and find that the items in the filter for the column are not ordered ascending. How can I assure that the filter menu list is ordered?
<GridColumn Field="@nameof(PackageRequest.Product)" Title="Product" Width="120px">
Hello, all,
I am implementing a solution to debounce the OnRead event of the TelerikComboBox using the following example:
https://docs.telerik.com/blazor-ui/components/combobox/events#onread
https://docs.telerik.com/blazor-ui/knowledge-base/combo-debounce-onread
Apparently, the Data property is missing from the args object passed into the OnRead handler. Following the class definitions up the inheritance chain does not reveal that it is present whatsoever.
Here is a screenshot of my code in progress, indicating the problem:
The documentation seems to indicate that the Data property should exist, inherited from ReadEventArgs.
I do not understand what could be missing here. Thanks in advance for assistance. :)
I currently am using version 2.30.0 of the Telerik UI for Blazor library.
Kindly,
Greg
Hi,
I started a small blazor project some week ago.
I've stared the project before the release 3.0 (I use the trial).But since then, I've updated to 3.0.1
The main component I use is the Grid and the combobox.
I have a sketch of my project to make a demo on the computer of my customer. On my machine (AMD Rzyen 5800H, Win 11, VS2022) eveything runs file. The first component is just a combobox that displays a list of date.
The I tried to deploy on the demo server of my customer (Win server 2019, IIS) and when I launch the app, the combobox is empy...
but the code is just a list of date to display
After spending several hours, I've decided to create an "empty" blazor project in order to test the combobox and deploy on the server and now, it's worse, enve on my computer, this new project is not able to display the combobox
I used the simpliest sample from the documentation, still the same.
Does anyone noticed something similar? is it a licence problem? why my elder developpement works fine and not the newest?
@page "/counter"
<PageTitle>Counter</PageTitle>
<h1>Counter</h1>
<p role="status">Current count: @currentCount</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
<TelerikButton OnClick="@OnClickHandler">Hello!</TelerikButton>
<TelerikComboBox Data="@MyList" @bind-Value="MyItem">
</TelerikComboBox>
@code {
private int currentCount = 0;
string result;
private void IncrementCount()
{
currentCount++;
}
protected List<string> MyList = new List<string>() { "first", "second", "third" };
protected string MyItem { get; set; }
//Define a preselected value when the component initializes
protected override void OnInitialized()
{
MyItem = "second";
}
async Task OnClickHandler()
{
result = DateTime.Now.ToString();
}
}
(PS on my new project, i followed all the instructions https://docs.telerik.com/blazor-ui/getting-started/server-blazor)
Regards;
Customer feedback about the TelerikMultiSelect is that it is not obvious about how to interact with it. Note that we are using it like a traditional ComboBox, the user does not expect to type into the control or use the search facility. There are only modest numbers of items so it's easiest to just open the list and select items. The following usage problems have been noticed:
Items 2 and 3 are the most irritating. As a workaround, I was considering putting a small button to the right of each MulitSelect, then clicking that button would toggle the open/close state. This would create the mock appearance of a ComboBox. However I can't find any way of toggling the open state in code.
Any comments or suggestions on these points would be very welcome.
Greg
I'm using Telerik.UI.for.Blazor 3.0.0 and pasting the following HTML does not lead to the expected result.
<ul>
<li>A</li>
<li>B</li>
<li>C</li>
</ul>Result (Preview):
<ul>
<li>A</li>
<li>B</li>
<li>C</li>
</ul>Result (Raw view):
<p><ul></p><p><li>A</li></p><p><li>B</li></p><p><li>C</li></p><p></ul></p>
Expected Result:
Using Telerik UI for jQuery it was sufficient to set the following setting to get the expected result.
$scope.kendoEditorOptions = {
pasteCleanup: {
keepNewLines: true, // Removes all HTML elements, such as the all option, but preserves new lines. Disabled by default.
}
}
I've tried out all different settings that the Blazor version offers using the demo from https://demos.telerik.com/blazor-ui/editor/paste-cleanup?_ga=2.205591514.897269513.1644322509-2087119569.1643891453, but without success.
For a workaround I've implemented the ValueChanged EventCallback to convert from
<p><ul></p>to
<ul>on-the-fly, but since each line of the pasted content is wrapped around with with <p>...</p> this is not optimal.
Is there a way to achieve the expected result? It would already help if the automatic wrapping with <p>...</p> tags could be turned off. Otherwise I'm leaning towards switching back to the jQuery version.
Thanks and BR!

Hello,
I am wanting to use a TelerikButton outside of my TelerikGrid to get the current selected row in the Grid, I do not want to use a GridRowButton on each row, but one TelerikButton outside of the grid.
For an example, we have a Grid of employees and each employee is an object in a list of EmployeeVM class objects. which has an EmployeeID for each employee. When the TelerikButton is clicked, I want to get the EmployeeID of the employee selected in the Grid in a method in the @code section that is the same as listed in the OnClick property on the Telerik Button.
I spent some time searching on Google but did not find what I was looking for, I am an experienced developer but new to Telerik UI for Blazor.
Thank you.
As of 3.01, the ExpandedField property of TreeViewBinding no longer exists and we're meant to bind the ExpandedItems property of the tree view instead. However, this is fine for a flat data source but doesn't really work for a hierarchical data source.
I'm loading my hierarchical data source to include all expanded nodes and child nodes so that I can reselect the previously selected node, and this can go down 5 levels or more. So how can I create an expanded items local variable to bind to tree view control from that?
The ExpandedField approach worked fine in this scenario, but I don't see how the ExpandedItems approach can. The only way I can see to resolve is to change my hierarchical data source to be flat which would be a lot of work and wouldn't really be ideal.
On another matter, the class applied to the selected tree node span element seems to have changed from k-state-selected to k-selected, although I don't see this documented anywhere.
Any advice on how I can get round the expanded items problem without drastically rewriting my code would be appreciated.
I'm currently trying to use AuthorizeView to inherit the Policy restrictions to programmatically show/hide the GridCommandButton
Something like this:
<AuthorizeView Policy="@Policies.ManageAllUsersPolicy">
<Authorized>
<GridCommandColumn Width="190px">
<GridCommandButton Command="Edit" Icon="edit">Edit</GridCommandButton>
</GridCommandColumn>
</Authorized>
</AuthorizeView>But I get an Error:
| Severity | Error |
| Code | RZ9999 |
| Description | The child content element 'ChildContent' of component 'GridCommandColumn' uses the same parameter name ('context') as enclosing child content element 'Authorized' of component 'AuthorizeView'. Specify the parameter name like: '<ChildContent Context="another_name"> to resolve the ambiguity |
I'm fairly new to the Kendo UI so I simply tried to name the Context directly on the AuthorizeView/Authorized component and GridCommandColumn (there's no Context property on GridCommanButton)
But without success.
Is it possible to use AUthorizeView, or should I move toward a solution where I manually check to the fulfillment of the policy and use a boolean to show/hide the button?