Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1010
NULL Reference on no parent rows
posted

I have a simple WHDG with only 2 levels.  I create a WHDS using two lists:

 

WebHierarchicalDataSource whds = new WebHierarchicalDataSource();
            DataView dvTeams = new DataView();
            dvTeams.ID = "Teams";
            dvTeams.DataSource = TeamInformationBLL.GetTeamList(CurrentUser.UserLoginInfoId, true);
            DataView dvGames = new DataView();
            dvGames.ID = "Games";
            dvGames.DataSource = GameStatisticsBLL.GetCoachGames(CurrentUser.UserLoginInfoId, null);
            DataRelation drGames = new DataRelation("Teams", "TeamId", "Games", "TeamId");
           
            whds.DataViews.Add(dvGames);
            whds.DataViews.Add(dvTeams);
            whds.DataRelations.Add(drGames);

            WebHierarchicalDataGrid1.DataSource = whds;
            WebHierarchicalDataGrid1.DataBind();

 

When the parent list (Teams) is empty (count=0) the page throws a null reference error on the .DataBind(). 

Why isn't it displaying the Empty Rows template?

 

Parents
No Data
Reply
  • 14049
    Offline posted

    Do you have the empty rows template defined? If so then this sounds like a bug. Thank you for letting us know.

    You can also define error template so only the grid renders the error (or whatever you would like to render in case of an error).

Children
No Data