views:

58

answers:

1

Hi, I have a windows forms application in 2.0 which uses a DataGridView. We have a new requirement to customize the DataGridView per user i.e. which columns need to be displayed, the order of the columns and column sizes would be stored by the users in a template. The template would be stored in the database against the user. When the user launches the form, he should see the data grid view according to the template he has defined.

So a user A would see the datagrid columns in the order Name Age Occupation whereas user B would see the columns Occupation Salary Name

I would like to know what would be the best approach to achieve this?

Thanks in advance :)

A: 

If you know how many columns there are:

  1. Create tables keyed by user ID.
    a. Table One - Boolean for each column (should it be displayed).
    b. Table Two - int for each column with relative ordering.
    c. Table Three - int for each column width

  2. Retrieve user preferences and set columns visible, ordering, and width accordingly.

  3. Save changes to preferences on exit event.

ShaunLMason