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
185
Runtime Exception: No child grid script descriptors are available!
posted

 <ig:WebHierarchicalDataGrid ID="whdg" runat="server" Height="350px" Width="400px" DataKeyFields="ID"></ig:WebHierarchicalDataGrid>

DataTable dtContract = new DataTable("Contract");
            dtContract.Columns.Add("ID");
            dtContract.Columns.Add("CName");

            DataRow drContract;
            drContract = dtContract.NewRow();
            drContract[0] = "11";
            drContract[1] = "Origin";
            dtContract.Rows.Add(drContract);

DataTable dtPipe = new DataTable("Pipe");
            dtPipe.Columns.Add("ID");
            dtPipe.Columns.Add("PName");

            DataRow drSwp;
            drSwp = dtPipe.NewRow();
            drSwp[0] = "11";
            drSwp[1] = "SWP";
            dtPipe.Rows.Add(drSwp);

DataSet ds = new DataSet();
            ds.Tables.Add(dtContract);
            ds.Tables.Add(dtPipe);

ds.Relations.Add("ID", ds.Tables["Contract"].Columns["ID"], ds.Tables["Pipe"].Columns["ID"]);

            whdg.DataSource = ds;
            whdg.DataBind();

ERROR: 

 

Parents
No Data
Reply
  • 49378
    posted

    Hi rajeshshirke,

    Thank you for posting in the community.

    I suggest that you try setting a primary key for both of your datatables in this scenraio, i.e:

    Code Snippet
    1.       DataTable dtContract = new DataTable("Contract");
    2.       dtContract.Columns.Add("ID");
    3.       dtContract.PrimaryKey = new DataColumn[] { dtContract.Columns[0] };
    4.       dtContract.Columns.Add("CName");
    5.  
    6.       DataRow drContract;
    7.       drContract = dtContract.NewRow();
    8.       drContract[0] = "11";
    9.       drContract[1] = "Origin";
    10.       dtContract.Rows.Add(drContract);
    11.  
    12.       DataTable dtPipe = new DataTable("Pipe");
    13.       dtPipe.Columns.Add("ID");
    14.       dtPipe.PrimaryKey = new DataColumn[] { dtPipe.Columns[0] };
    15.  
    16.       dtPipe.Columns.Add("PName");
    17.  
    18.       DataRow drSwp;
    19.       drSwp = dtPipe.NewRow();
    20.       drSwp[0] = "11";
    21.       drSwp[1] = "SWP";
    22.       dtPipe.Rows.Add(drSwp);
    23.  
    24.       DataSet ds = new DataSet();
    25.       ds.Tables.Add(dtContract);
    26.       ds.Tables.Add(dtPipe);
    27.       
    28.       ds.Relations.Add("IDRl", ds.Tables["Contract"].Columns["ID"], ds.Tables["Pipe"].Columns["ID"]);
    29.  
    30.       whdg.DataSource = ds;
    31.  
    32.      whdg.DataBind();

    Please let me know if this helps.

Children