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


    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.

    <FONT color=#008000 size=2>

    //Add row on parent table

    </FONT><FONT size=2>

    </FONT><FONT color=#2b91af size=2>DataSet</FONT><FONT size=2> ds = (</FONT><FONT color=#2b91af size=2>DataSet</FONT><FONT size=2>)FpSpread1.Sheets[0].DataSource;

    </FONT><FONT color=#2b91af size=2>DataTable</FONT><FONT size=2> dt = ds.Tables["Parent"];

    </FONT><FONT color=#2b91af size=2>DataRow</FONT><FONT size=2> dr;

    dr = dt.NewRow();

    dr[3] = </FONT><FONT color=#a31515 size=2>"new row"</FONT><FONT size=2>;

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


  • Replied 8 September 2017, 12:49 pm EST


    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