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
180
Parent/Child tables in Dataset - an easy one I suspect
posted

I am using code very similar to the example in the article entitled "Binding to a Hierarchical SQL Database". My parent fields are KeyPrefix,ObjTypeDescr,aTypeID my Child Fields are ObjKey,ObjName,bTypeID.

In FieldLayoutInitialized I set the Visibility of the "aTypeID' column to false. I want to do the same with bTypeID. When I check the fields as below

MsgBox(e.FieldLayout.Fields(3).Name)

I see my fourth "field" is "Hierarchy" and I do not see the fifth and sixth fields. I would be obliged if someone could post some sample code so that I could understand how I can interogate my fourth field object to discern the actual column names for the purpose of setting their visibility to false.

Thanks

Parents
  • 69686
    posted

    Hello,

    The fourth field that you see is for creating hierarchy and not the actual field from your child table. What you need to do is the same thing you do with the parent table in the FieldLayoutInitialized event. This event will be fired when each fieldlayout is expanded. So, when you first load the data, only one field layout will be generated - parent layout. When you expand any record, this event will fire for the child layout so you can set the Visibility of the ID column there.

    Let me know if you have further questions on this.

Reply Children