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
470
Best way to set Hidden property on row
posted

I use a datatable as datasource for the grid. When I add a row to the datatable I would like to control the Hidden property based on a value in DataRow or other value. The problem I see is that there is no direct link to the UltraGridRow when adding anything to the DataTable.

What is the best way to sync this?

  • 23930
    Offline posted

    Hello Henrik,

    I am just checking about the progress of this issue. Let me know if you need my further assistance on this issue.

    Thank you for using Infragistics Components.

  • 23930
    Suggested Answer
    Offline posted

    Hi Hennrik,

    Thank you for posting in our forums.

    What you could do in your case is to use the InitializeRow event in order to see when a new row has been added to the grid. In the event you can check if the row is new by seeing if the ReInitialize property of the event arguments is true or false. If it is false then it means that this is the first row has been initialized. Then you can get the underlying DataRowView by using the ListObject property of the row and you can set its Hidden property based on the value in the DataRow:

     private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)

            {

                if (e.ReInitialize == false)

                {

                    var dataRow = e.Row.ListObject as DataRowView;

                    e.Row.Hidden = dataRow.Row.Field<bool>("Hidden");

                }

            }

    Please let me know if you have any additional questions.