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
1705
Creating and binding an UltraGrid programmatically
posted

Hey guys, 

Could somebody please tell me why this does not create columns in the grid?

 

//create grid

UltraGrid grid = new UltraGrid();

//assign datasource to a list (IList)

  grid.DataSource = new CalcList { new CalcBO() };

 //Bind the grid

 grid.DataBind();

 

Simple, bu it doesn't work. I noticed though that if I add the grid via the designer it works (as opposed to declare it with code).

 

Thanks in advance.

Parents
  • 37774
    posted

    Is the grid on a form?  If you're creating the grid in code and it's not on anything, at the very least it needs a binding context, so do:

    grid.BindingContext = new BindingContext();

    -Matt

Reply Children
No Data