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
415
Very basic UltraGrid binding issue
posted

Why is it that I have no problem binding to a grid that has been dropped onto a form but if you declare a grid in code and bind to it, it always comes back with 0 columns.

Easy sample program:

        Infragistics.Win.UltraWinGrid.UltraGrid myGrid = new Infragistics.Win.UltraWinGrid.UltraGrid();

         List<int> myList = new List<int>();

         myList.Add( 1 );

         myList.Add( 2 );

         myGrid.DataSource = myList;

myGrid.displayLayout.Bands[0].Columns.Count == 0 whereas if I had dropped a grid to the form, and did the exact same thing, I would get a column come back.

 

basically I am trying to code a custom drop down(by extending from ultratext editor and declaring a grid inside but now I cannot bind data to the drop down grid)

 

Parents
  • 469350
    Offline posted

    A grid with no form has no BindingContext. Also, if you don't add it to the form's Controls collection, it won't get disposed.

    So you probably just have to do this.Controls.Add(myGrid) before you set the grid's DataSource and that should fix it.

Reply Children