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
1850
Column Structure Question
posted

I have an object with three fields (Time, Units, and dollars) . I need them to show up in columns but I need them to show up in the grid 13 times (for 13 weeks). Each week would have its own header with the Time, Units, and dollars as columns within that week.

What is the best way to make this happen? We don't use datasets but class objects. I tried having an object with WeekOne, WeekTwo, etc properties that were Lists of my field object but that didn't work.

Any ideas are appreciated.

thanks

-Ken

Parents
  • 69832
    Verified Answer
    Offline posted

    kvillines said:
    I tried having an object with WeekOne, WeekTwo, etc properties that were Lists of my field object but that didn't work.

    It might help if you could elaborate on how/why this didn't work for you. My initial thought before I read that part was that you could have an object that represents a week, and expose 'Time', 'Units', and 'Dollars' properties off that class. The property implementations can just route through to an instance of that class that you don't expose, so that the user only sees the properties of that Week object, but is in actuality communicating with your time/units/dollars object. You then add 13 instances of this week object to a BindingList<Week>, and assign that list to the grid's DataSource. This will make each of the 13 weeks appear as rows, not columns, but from the user's perspective this might be better anyway.

    If your design requires that the user see those three columns repeated for each of the 13 weeks, you would have to create some kind of proxy object that has 39 properties (time/unit/dollars for each of the 13 weeks) and assign a list of those to the grid's data source.

Reply Children