Telerik Forums
UI for Blazor Forum
1 answer
323 views

Hello, right now, I am getting the "Object reference not set to an instance of an object." error for rendering the Gantt Timeline. I'm not sure how to send the data from the Gantt Tree to the timeline or setting the timeline to the correct model. The tree renders just fine. Help with understanding Data Binding with the parameters (IdField, ParentIdField, ItemsField, HasChildrenField) will be great as well.


Razor Page:


<TelerikGantt Data="@SchedulesList"
                  @bind-View="@SelectedView"
                  IdField="Id"
                  ParentIdField=""
                  Width="100%"
                  Height="600px"
                  Sortable="true"
                  SortMode="@SortMode.Multiple"
                  FilterMode="@GanttFilterMode.FilterMenu"
                  FilterMenuType="@FilterMenuType.Menu">
               
        <GanttViews>
            <GanttDayView></GanttDayView>
            <GanttWeekView></GanttWeekView>
            <GanttMonthView></GanttMonthView>
            <GanttYearView></GanttYearView>
        </GanttViews>
        <GanttColumns>
            <GanttColumn Field="Sequence"
                         
                         Title="Sequence">
            </GanttColumn>
            <GanttColumn Field="ScheduledStart"
                        
                         Title="Scheduled Start"
                         >
            </GanttColumn>
            <GanttColumn Field="ScheduledEnd"
                        
                         Title="Scheduled End">
            </GanttColumn>
            <GanttColumn Field="ScheduledDuration"
                         
                         Title="Scheduled Duration">
            </GanttColumn>
            <GanttColumn Field="Activity.Name"
                        
                        Title="Activity Name">
            </GanttColumn>
            <GanttColumn Field="Resource.Name"
                         
                         Title="Resource Name">
            </GanttColumn>
        </GanttColumns>
    </TelerikGantt>



@code {
    private List<VentureBlazor.Models.ActivityResource> SchedulesList { get; set; }
    private List<VentureBlazor.Models.Activity> ActivitiesList { get; set; }
    private List<VentureBlazor.Models.Resource> ResourcesList { get; set; }
    private ActivityScheduleRepository repo;
    public GanttView SelectedView { get; set; } = GanttView.Year;

    protected override async Task OnInitializedAsync()
    {
        repo = new ActivityScheduleRepository(ContextFactory.CreateDbContext());
        await LoadSchedules();
         
        base.OnInitialized();
       
    }

     public async Task LoadSchedules()
    {
        ActivitiesList = await repo.GetAllActivitiesAsync();
        ResourcesList = await repo.GetAllResourcesAsync();
        SchedulesList = await repo.GetAllActivityResourceSchedulesAsync();

    }

      public void Dispose()
        {
            repo.Dispose();
        }
}
Model:

 public class ActivityResource
    {
        [Key]
        public int Id { get; set; }
        public int ActivityId { get; set; }

        public int ResourceId { get; set; }

        public double Sequence { get; set; }

        public DateTime ScheduledStart { get; set; }

        public DateTime ScheduledEnd { get; set; }

        public double ScheduledDuration { get; set; }

        public Activity Activity { get; set; }

        public Resource Resource { get; set; }
    }

    public class Resource
    {
        public int Id { get; set; }
        public string Name { get; set; } = "New Resource";
        public string Description { get; set; }

        public int ResourceTypeId { get; set; }
        public virtual ResourceType ResourceType { get; set; }



        public ICollection<Activity> Activities { get; set; }
        public ICollection<Project> Projects { get; set; }


        public List<ActivityResource> ActivityResources { get; set; }
        public List<ProjectActivity> ProjectActivities { get; set; }


    }


Nadezhda Tacheva
Telerik team
 answered on 28 Jan 2022
1 answer
818 views

Hello,

I'm trying to use font-awesome in the Blazor Drawer. I can use the font anywhere except with the Drawer.

For my test, you can look at the first MenuItem for Trucks.

Thanking you in advance.

Daniel Legare

 

@inherits LayoutComponentBase


<TelerikRootComponent>
<TelerikDrawer @ref="SidebarLeft" Data="menuItems" MiniMode="true" Mode="@DrawerMode.Push" @bind-SelectedItem="SelectedItem">
<DrawerContent>
<div class="main">
<div class="top-row px-4">
<TelerikButton OnClick="@ToggleDrawer" Icon="menu" FillMode="@(ThemeConstants.Button.FillMode.Flat)"></TelerikButton>
<a href="http://blazor.net" target="_blank" class="ml-md-auto">About</a>
</div>

<div class="content px-4">
@Body
</div>
</div>
</DrawerContent>
</TelerikDrawer>
</TelerikRootComponent>

@code {
public TelerikDrawer<MenuItem> SidebarLeft { get; set; }
        public MenuItem SelectedItem { get; set; }

public async Task ToggleDrawer() => await SidebarLeft.ToggleAsync();

private IEnumerable<MenuItem> menuItems => new List<MenuItem>
{
new MenuItem {Text = "Trucks", Url = "/truck", Icon = "<i class='fa-solid fa-truck' />"},
new MenuItem {Text = "Clients", Url = "client", Icon = "myspace"},
new MenuItem {Text = "Earth", Url = "/earth", Icon = "globe"},
new MenuItem {Text = "Contacts", Url = "/contact", Icon = "user"},
};
}
Chuck
Top achievements
Rank 1
Iron
 updated answer on 28 Jan 2022
1 answer
190 views

Dear Telerik Team!

Is there a way to make the treeview scroll so that a speficic node is visible? I need to make the node visible that was selected by code.
So I am looking for a way to do what the .BringIntoView() method in the WPF treeview does...

thanks and regards

Sven

Dimo
Telerik team
 updated answer on 27 Jan 2022
2 answers
223 views

Is anyone using the code from the free book and getting it to build/run?

I can't get past the event call back code on pages 46-47. I find the code references OnSelected="HandleItemSelected" delegate when no procedure/var exists with that name. I think I need to add a delegate to WeatherDay component.

Book:

<WeatherDay TemperatureC="forecast.TemperatureC"
Summary="@forecast.Summary"
DayOfWeek="forecast.Date.DayOfWeek"
OnSelected="HandleItemSelected"
Selected="forecast.Selected">

I tried:

<WeatherDay TemperatureC="forecast.TemperatureC"
Summary="@forecast.Summary"
DayOfWeek="forecast.Date.DayOfWeek"
OnSelected="HandleOnSelected"
Selected="forecast.Selected">

Ed
Top achievements
Rank 1
Iron
 answered on 26 Jan 2022
1 answer
429 views
I want to prevent the user browsing back to previous days
Nadezhda Tacheva
Telerik team
 answered on 26 Jan 2022
1 answer
456 views

 

1. Is it possible to export an hierarichal grid to excel (with all its nested levels nd their values ).

Marin Bratanov
Telerik team
 answered on 26 Jan 2022
1 answer
288 views

I'm trying to programmatically change the value of an existing ComboBox to something that's not in the last OnRead args.Data list.  Is there a way for me to achieve this and populate the TextField? The only way I can see is to destroy the control and remake it, triggering the initialization OnRead. 

Dimo
Telerik team
 updated answer on 25 Jan 2022
4 answers
665 views

I am looking to set the background color on the active tab's title. But I need to reset every other one to it's original color first. 

Which, usually, requires a loop of some sort.

Any help would be great.

Thanks ... Ed

 

Missing User
 answered on 25 Jan 2022
2 answers
231 views

Hi

I have just updated an application to UI for Blazor 3.0.0 - upgraded the nuget packages fine.  I then used the ThemeBuilder to update my css - but when i run the application is looks like there are issues with the CSS e.g. unstyled input boxes etc.

If i use  href="_content/Telerik.UI.for.Blazor/css/kendo-theme-default/all.css" then things look right again, however they are not to my custom theme - are the ThemeBuilder outputs not up to date with the new release?

Wim
Top achievements
Rank 1
Iron
 answered on 25 Jan 2022
1 answer
296 views

Hi, I'm trying to run the blazor coffee demo on .NET 6 and VS2022.

At first it fails to load and complains about not finding files related to blazor hot reload, and after turning off the hot reload feature the app starts but it can't find main.css and aspnetcore-browser-refresh.js?

Is this not supported yet?

Joana
Telerik team
 answered on 25 Jan 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?