I am getting error "No child records to display." while trying to bind a Hierarchygrid
Here is the code, please help.
Here is the code, please help.
<telerik:RadGrid ID="RadGrid1" runat="server" OnDetailTableDataBind="RadGrid1_DetailTableDataBind"> <MasterTableView DataKeyNames="PayerID"> <DetailTables> <telerik:GridTableView runat="server" Name="Plan" DataKeyNames="PlanID"> <ParentTableRelation> <telerik:GridRelationFields DetailKeyField="PlanID" MasterKeyField="PayerID" /> </ParentTableRelation> </telerik:GridTableView> </DetailTables> </MasterTableView> </telerik:RadGrid>public partial class Default : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { RadGrid1.DataSource = GetPayer(); RadGrid1.DataBind(); } } DataTable GetPlans() { DataTable dt = new DataTable(); dt.Columns.Add("PlanID", typeof(string)); dt.Columns.Add("PayerID", typeof(string)); dt.Columns.Add("PlanName", typeof(string)); dt.Columns.Add("HQState", typeof(string)); dt.Columns.Add("OPState", typeof(string)); dt.Columns.Add("Status", typeof(string)); dt.Rows.Add("0022", "0001", "Red One", "NJ", "NJ", "Open"); dt.Rows.Add("0002", "0002", "Red One", "NJ", "NJ", "Open"); return dt; } DataTable GetPayer() { DataTable dt = new DataTable(); dt.Columns.Add("PayerID", typeof(string)); dt.Columns.Add("PayerName", typeof(string)); dt.Columns.Add("HQState", typeof(string)); dt.Columns.Add("OPState", typeof(string)); dt.Columns.Add("Status", typeof(string)); dt.Rows.Add("0001", "Red One Payer", "NY", "NY", "Open"); dt.Rows.Add("0002", "Red Two Payer", "NJ", "NJ", "Open"); return dt; } protected void RadGrid1_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e) { e.DetailTableView.DataSource = GetPlans(); }}