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
1106
Populating the Child Foreign Key Automatically
posted

I have started playing with this under eval and so far so good, I created three test tables TOP ( With TOPID ) ,middle ( with MIDDLEID and TOPID ) and finally Bottom ( With BottomID and MiddleID ) as Primary and Fireign Keys respectively.

I can see the data and expand collapse etc. I can add rows to the TOP OK ( All  PK IDs are Identity Columns )

My issues is when I want to add a row the middle or bottom children, it does not autimatically add the parent PK into the FK column, so in order to create the row I have to do this manually by entering it in.

Im sure I have missed something basic, please could someone ellighten me on how to do this.

Many Thanks,

Parents
  • 1106
    Verified Answer
    posted

    Tired of wating for a response, I found a solution myself.

     

     

     

     

     

     

     

     

     

     

    protected void WebHierarchicalDataGrid1_RowAdding(object sender, Infragistics.Web.UI.GridControls.RowAddingEventArgs e)

    {

     

     

    var container = (Infragistics.Web.UI.GridControls.ContainerGrid)sender;

     

     

    switch( container.Level )

    {

     

     

    case 1: e.Values["TopID"] = container.ParentRow.DataKey[0];

    break;

     

     

    case 2:

    e.Values[

    "MiddleID"] = container.ParentRow.DataKey[0];

    break;

    }

Reply Children
No Data