I am trying to create a new project using Telerik C# Blazor Application template in Visual Studio 2022. I am able to go through the template steps however on finish no project is created. The message bar at the bottom of visual studio says it was successful. I have Telerik UI for Blazor Extension installed and enabled.
Is there a way to have a dropdownlist item be a color based on some criteria?
Hi @all,
I am currently trying to create a TreeDropDownComponent.
so far it works, but I have the problem that it doesn't make sense inside a grid.
I am currently trying to create a TreeDropDownComponent.
so far it works, but I have the problem that it doesn't make sense inside a grid.
Because this component inside the grid cell
and so the popupElement is not above the grid. Does anyone have an idea how I can fix this?
here is my css and code:
@using Telerik.Blazor
@using Telerik.Blazor.Components
<div id="treeSelectorComponent">
<span class="telerik-blazor k-dropdownlist k-valid k-picker k-picker-solid k-picker-md k-rounded-md"
onclick="@ToggleDropdown">
<span class="k-input-inner @( DropDownShown ? "k-state-focused" : "" )">
<span class="k-input-value-text">@GetSelectedItemsText()</span>
</span>
<button class="telerik-blazor k-button k-input-button k-button-solid k-button-md k-button-solid-base k-icon-button"
type="button">
<span class="telerik-blazor k-button-icon k-icon k-i-caret-alt-down"></span>
</button>
</span>
<TelerikAnimationContainer @ref="dropdown" Class="k-popup treeView-scrollable-element" >
<TelerikTreeView Data="TreeItems"
SelectionMode="TreeViewSelectionMode.Single"
OnItemClick="OnTreeItemClicked">
<TreeViewBindings>
<TreeViewBinding ParentIdField="ParentId"
TextField="Text"
IdField="Id">
<ItemTemplate>
@{
TreeItemSelector item = context as TreeItemSelector;
<span>@item!.Text</span>
}
</ItemTemplate>
</TreeViewBinding>
</TreeViewBindings>
</TelerikTreeView>
</TelerikAnimationContainer>
</div>
@code {
private bool DropDownShown { get; set; }
private TelerikAnimationContainer dropdown;
[Parameter, EditorRequired]
public List<TreeItemSelector> TreeItems { get; set; } = new List<TreeItemSelector>();
[Parameter]
public int TreeId { get; set; } = default!;
[Parameter]
public EventCallback<int> TreeIdChanged { get; set; }
async Task ToggleDropdown()
{
DropDownShown = !DropDownShown;
await dropdown.ToggleAsync();
}
string GetSelectedItemsText()
{
return TreeItems.FirstOrDefault(p => p.Id == TreeId)?.Text!;
}
private async Task OnTreeItemClicked(TreeViewItemClickEventArgs arg)
{
var item = arg.Item as TreeItemSelector;
TreeId = item!.Id;
if(TreeIdChanged.HasDelegate)
await TreeIdChanged.InvokeAsync(TreeId);
await ToggleDropdown();
}
public class TreeItemSelector
{
public int Id { get; set; }
public string Text { get; set; }
public int? ParentId { get; set; }
public bool HasChildren { get; set; }
}
}
#treeSelectorComponent {
.k-popup {
&.treeView-scrollable-element{
overflow-y: auto;
max-height: 300px;
}
}
}
Hello, good afternoon.
I'm following this page's documentation to build a hierarchy grid. I just copied and pasted the code from the "Expand Rows From Code" example into my project just to see how it works (we are migrating Razor projects to Blazor).
I can see the grid is displayed with the "+" button to expand child grids on each row and even the button to expand all the rows at the top as it is shown in the image below:
Both do nothing, and DetailTemplate doesn't show up.
Some technical stuff:
I hope this helps. I tried following the documentation without success.
I have a TelerikGrid and the TelerikLoader is showing when data is OnRead.
My rows have detail template, that when you expland the row, I want another Loader window displayed while the detail data is retrieved.
I have tried the samples from Telerik but cannot get it to work. Either the Loader does not show at all, OR, I can get it to show and never hide
pls halp
G
Hello,
I want to create a grid like this with Telerik Blazor Grid:
Is it possible to do this using Multi Column Header function ?
here's my code :
@{
strMonth = string.Empty;
iWeek = 0;
<GridColumn Field="@dtGrid.Columns[0].ColumnName" FieldType="@dtGrid.Columns[0].DefaultValue.GetType()" Width="150px"></GridColumn> //Member
<GridColumn Field="@dtGrid.Columns[1].ColumnName" FieldType="@dtGrid.Columns[1].DefaultValue.GetType()" Width="150px"></GridColumn> //Project
for (int colMonth = 2; colMonth <= dtGrid.Columns.Count - 1; colMonth++)
{
if (DateTime.TryParse(dtGrid.Columns[colMonth].ColumnName, out dt))
{
if (strMonth != dt.ToString("MMMM"))
{
strMonth = dt.ToString("MMMM");
<GridColumn Title="@strMonth" FieldType="@dtGrid.Columns[0].DefaultValue.GetType()">
<Columns>
@{
iWeek = Helper.Common.GetWeekOfYear(dt);
for (int colWeek = colMonth; colWeek <= dtGrid.Columns.Count - 1; colWeek++)
{
if (DateTime.TryParse(dtGrid.Columns[colWeek].ColumnName, out dt))
{
if (strMonth != dt.ToString("MMMM"))
{
colMonth = colWeek;
break;
}
if (iWeek != Helper.Common.GetWeekOfYear(dt))
{
colMonth = colWeek;
break;
}
<GridColumn Title="@string.Format("Week {0}", iWeek)" FieldType="@dtGrid.Columns[0].DefaultValue.GetType()">
<Columns>
@for (int iDay = colWeek; iDay <= dtGrid.Columns.Count - 1; iDay++)
{
if (DateTime.TryParse(dtGrid.Columns[iDay].ColumnName, out dt))
{
if (iWeek != RR.BusinessLogicLayer.Helper.Common.GetWeekOfYear(dt))
{
colWeek = iDay;
break;
}
<GridColumn Field="@dt.Day.ToString()" FieldType="@dtGrid.Columns[colWeek].DefaultValue.GetType()" Width="150px"></GridColumn>
}
}
</Columns>
</GridColumn>
}
}
}
</Columns>
</GridColumn>
}
}
}
}
Above code only can get me until Month Column, when i debug it iWeek only fires after all column rendered ? so , it can't create the Child Column of Months Column.
How can i fix it so it can show Multi Header of Months, Week and Day
How can I add dropdowlist for changing theme in my project like for demos Blazor UI components.
Thanks
Peter