This is a migrated thread and some comments may be shown as answers.

Dynamic Columns in Grid

0 Answers 77 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
AndiRudi
Top achievements
Rank 1
AndiRudi asked on 24 May 2012, 08:52 PM
I am aware that there are some other threads on that topic, but i want to explain my case, because maybe someone has a workaround on that.

I want to specify the columns in the model, not in the view. The idea behind is to mark all memers of a particular model that the user may see with a new self-created attribute. The attribute may be called [UserVisibleInGrid]. 

For easier understanding lets talk about the model "Address":

class Address
{
    [UserVisibleInGrid]
    public string Firstname{ get; set;}
 
    [UserVisibleInGrid]
    public string Streeet {get; set;}
}

On each grid i want to add custom definitions of views (like in sharepoint). When the grid is displayed it shows the columns stored in the view definition. 

The user may add or remove columns by context-menu, add filters and sort the grid or alternatively open a dialog to enter more complex queries. Then the user can store that view definition for later use. In the context-menu and in the alternative dialog all columns that are marked, should be shown (using reflection and the attribute above). 

The only possible way of doing this at the moment seems to add all columns in the view and then show/hide them. But this means i've to add a special grid for every model. Since i've lot of models I don't want to specify this twice. I want to create a control which adds the above functions to the grid and can then be used on the views without adding any columns there.

I think this would be a great functionality for professional web applications. So if anyone want to share some ideas about this, you are welcome :)


Tags
Grid
Asked by
AndiRudi
Top achievements
Rank 1
Share this question
or