Hierarchical Grid Parent Child Insert "on one click"

Posted by: bsmith21 on 8 September 2017, 12:49 pm EST

  • Posted 8 September 2017, 12:49 pm EST

    Hi,


    I have a button for inserting a new row . Right now it inserts the parent row with blank fields but I want it also to do the child at the same time with blank rows and have it expanded to show that.


    here is my code for the parent, i figured i could do the same for the child but nothing happens.


    I got this off one of the posts but he was using two buttons, i want to do it all at once.


    //Add row on parent table


    DataSet ds = (DataSet)FpSpread1.Sheets[0].DataSource;


    DataTable dt = ds.Tables["Parent"];



    DataRow dr;



    dr = dt.NewRow();



    dr[3] = "new row";


    dr[4] = dt.Rows.Count - 1;



    dt.Rows.Add(dr);

  • Replied 8 September 2017, 12:49 pm EST

    Hello,


    You can use the same logic code to add rows into the child DataTable as well. To have the rows show up as children of the parent, you need to fill in the data for the DataColumn in the parent and child DataTable that are related to each other with the same data.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels