Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi,
this is not a question related to any code.i know there are very experienced and genius
programmers out there all i need is a suggestion.

im developing a list page which has more than 20 columns.i know its bit long.so i want to make it more flexible,the idea is..i want the user to select which columns they need to see in the list.n based on their selection data must be bring back from the back end(only
the selected columns).we have a very huge database so.i want to make very optimized request..please suggest a best way to implement this..
Posted
Comments
DamithSL 19-Dec-14 0:31am    
you specify language as c# but what is the technology like winform/wpf or..?
NowYouSeeMe 19-Dec-14 0:38am    
actually its a web application..mvc4 to be specific
BillWoodruff 19-Dec-14 0:37am    
I can see doing this a variety of ways, including switching between two "views" of your list-grid: a column selection view, and then, when columns are selected, a view where the not-selected columns are hidden, or folded, or whatever.

There are several excellent Controls on CodeProject (for WinForms) that would let you do this easily, and I imagine there are similar Controls here for WPF (or ASP ?).

If you give more details, I will respond further.
NowYouSeeMe 19-Dec-14 0:45am    
its a web application(mvc4)..the thing is i want to generate a sql query based on that selected column only..is it possible to dynamically change queries based on selection..i mean im talking about 20 check boxes with the colmun names..!!
BillWoodruff 19-Dec-14 5:32am    
If it's a web app using MVC: not my area, sorry. But, what you describe sounds quite possible.

1 solution

Here are some steps:

1. Each of your 20 database columns must be associated with a flag that have to be set or cleared if that column was selected or not. To implement this the best way is by using a bits field, so you will need a new column for storing the value of the bit fields. For more details about managing bits fields see the next article: Masks and flags using bit fields in .NET[^]

2. When the user will select and/or deselect a set of columns ==> the associated flags have to be updated (from false to true or viceversa) by using the logic from the 1st point above, then the new value of the "bits field" column must be stored in the database.

3. Your used UI control (Grid, ListView, table, etc) have to be generated dynamically in your view by using razor code and by checking the "bits field".

4. Because you are using a huge database, you must implement pagination to speed up the loading and the user iteration with your application.

PS: You could search for pagination articles on the web and you could have a look also on my articles about MVC, jqGrid and pagination.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900