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
590
Displaying a 2 dimensional array in the grid
posted

What I need to do is display a two-dimensional array in a grid -- a matrix with both row and column headers.  Both row and column counts vary based on user input.  It might be 5X5, or 7X7, or 13X6, whatever.  The key issue is that the number of columns varies, as do the column headers.  I want to give the grid a list of headers, and have it get its data by row/column index.  I would greatly prefer not to use a DataTable to achieve this.  Do I need to do this entirely with unbound columns?  If so, do I have to loop to set every value in the grid?  I know that the grid has to be bound to something, and I am not sure what that would be in this case.

Additionally, I would like to have row headers as well as column headers.  Does anybody have any suggestions as to whether/how this can be done?

Parents
  • 469350
    Offline posted

    You cannot use a WinGrid completely unbound, it must have a DataSource.

    What I would recommend is that you use an UltraDataSource component as your grid's DataSource in virtual mode. Check out the Virtual Mode sample. Basically, the way it works is that you define the columns in the UltraDataSource and tell it the total number of rows and then you handle events to populate the data which is requested as-needed by the grid. 

     

  • 249
    posted in reply to Mike Saltzman

    Hi Mike,

    that doesn't quite do it in my case. I have to reproduce the following grid:

    Now at the back end I have the following options: Multi dimensional array, dictionary or a list of lists (that last option is actually what I have but I could change it to one of the other two).

    The task is obvious: Get that data bound to the grid. Filling the whole thing up manually is the last thing I want to do.

    Now surely the UltraGrid will not let me down and be better than the old grid? ;-)

Reply Children
No Data