EmptyDataTemplateBehavior with multiple gridviews

3 posts, 0 answers
  1. Dipti
    Dipti avatar
    37 posts
    Member since:
    Dec 2011

    Posted 13 Feb 2012 Link to this post

    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. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 14 Feb 2012 Link to this post

    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 >>
  3. Dipti
    Dipti avatar
    37 posts
    Member since:
    Dec 2011

    Posted 15 Feb 2012 Link to this post

    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
Back to Top