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
765
Looking at datasource in ColumnLayoutAssigned event
posted

Hi,

I want to set allowaddnewrow on my columnlayout based on the content of my datasource in the columnlayoutassigned event. How can I get the datasource for the columnlayout being assigned?

Parents
No Data
Reply
  • 6912
    Verified Answer
    posted

    Hi,

    You can use the ColumnLayoutAssignedEventArgs to get information about the data source:

    private void XGrid_ColumnLayoutAssigned(object sender, ColumnLayoutAssignedEventArgs e)
    {
        // The type of data that this ColumnLayout will represent.
        Type type = e.DataType;
    
        // The collection of rows or row island that this particular ColumnLayout will represent.
        RowCollection rowCollection = e.Rows;
    
        RowBase row = rowCollection.FirstOrDefault();
    
        if (row != null)
        {
            var itemsSource = ((RowsManager)row.Manager).ItemsSource;
        }
    }
    
    

    HTH

Children
No Data