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
1285
How to edit fields of child grid
posted

I have a grid which has a number of child grids.  I need to hide/change other field properties using code.  I am a little lost when/how to do this.  I bind the datasource in code.  After setting datasource I only see one fieldLayout.  Any help will be greatly appreciated.

Thanks

Parents
  • 69686
    posted

    Hello,

    Before getting to your question, I have couple of questions to clarify your setup. What do you mean by "grid has number of child grids"? Do you mean that the XamDataGrid has hierarchical data and you have nested content? If this is so, how do you see only one FieldLayout? Is your data structure hierarchical?

    Assuming that you have a hierarchical XamDataGrid and you want to toggle the visibility of some fields. Each FieldLayout exposes a Fields collection that contains all of the fields in this layout. You can use this collection to change the Visibility property of the specific field you want. Different field layouts you can find in the FieldLayouts collection of the XamDataGrid. For example, if you want to hide the first field in the nested layout (in the first child layout) you can use the following:

    xamDataGrid1.FieldLayouts[0].Fields[0].Visibility = VIsibility.Collapsed;

    Please note that, the FieldLayouts are generated only when they are visibile. If you have not expanded the child layout, it will not be generated until you expand at least one record.

    Let me know if you have questions on this.

Reply Children