This is a migrated thread and some comments may be shown as answers.

EmptyDataTemplateBehavior with multiple gridviews

2 Answers 53 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dipti
Top achievements
Rank 1
Dipti asked on 14 Feb 2012, 05:23 AM
Hi,

I have made a user control which shows may dashboards. These dashboards contain gridviews. 

For each gridview, i have implemented EmptyDataTemplateBehavior. It works fine when I run it individually.
When I run the integrated screen, EmptyDataTemplateBehavior causes a crash. When i debugt , the source of "gridView.ChildrenOfType<Grid>()" comes as null in the following line:

Grid rootGrid = gridView.ChildrenOfType<Grid>()[1];

 Please let me know how to make this work on a screen containing several gridviews. 

Thanks.

2 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 14 Feb 2012, 07:38 AM
Hello Dipti,

You can get the root element as follows:

//Option 1:
Grid rootGrid = gridView.ChildrenOfType<Grid>().FirstOrDefault();
//Option 2:
Grid rootGrid = gridView.ChildrenOfType<Grid>().ElementAt(0);
 


All the best,
Maya
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Dipti
Top achievements
Rank 1
answered on 15 Feb 2012, 01:40 PM
Hi Maya,

I have tried that too.

The issue is that gridView.ChildrenOfType<Grid>().Count() is 0.
Though when i debug i notice that gridView is referring to correct grid. But it doesn't have ChildrenOfType information.

Thanks,
Dipti
Tags
GridView
Asked by
Dipti
Top achievements
Rank 1
Answers by
Maya
Telerik team
Dipti
Top achievements
Rank 1
Share this question
or