Error "Empty GridView Message Content" in GridView SDK

1 Answer 113 Views
GridView
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
Psyduck asked on 29 Jun 2021, 05:54 AM

Hello.

I am trying to use Empty GridView Message Content of GridView in SDK.

I saw an error when using GridView Empty inside a TabControl.

How do I solve this part?

 

EmptyGridViewMessageBehavior.cs

private void InsertAdditionalContentControl() { if (this.additionalContentControl.Content != this.messageContent) { this.additionalContentControl.Content = this.messageContent; } var rootGrid = this.gridView.FindChildByType<Grid>(); // rootGrid is Null. rootGrid.Children.Add(this.additionalContentControl); // System.NullReferenceException }

//If I put TabControl, TabItem instead of Grid in FindChildByType<Grid>, rootGrid.Children could not be resolved.

 

Thanks.

1 Answer, 1 is accepted

Sort by
1
Accepted
Martin Ivanov
Telerik team
answered on 01 Jul 2021, 05:10 PM

Hello KIM,

The tab control content loading behaves a bit different than the default loading logic in the framework, so the Loaded event in this case fires earlier than expected. To get the desired effect, you can delay the InsertAdditionalContentControl call a bit. For example:

this.gridView.Dispatcher.BeginInvoke(new Action(() => { 
	this.InsertAdditionalContentControl();
}));

Regards,
Martin Ivanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
GridView
Asked by
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
Answers by
Martin Ivanov
Telerik team
Share this question
or