show collapsible datagrid headers

G

Guest

Hi,

I am trying to build the following functionality in the datagrid.

I have a lot of columns in the datagrid which are being populated from the
database and the user needs to scroll horizontally to view these coloumn
names.
So I want to group them into
categories which will fit into a page.
A user clicks a category and the category should
expand into its underlying set of columns belonging to that category.The
categories may be statically defined in the aspx page but the columns are
coming from the database.

So initially when the grid loads the user only sees the main categories of
the data as column headers.He can click the column headers and they
should expand to display the set of columns and their data

How do I do this?

Thanks in advance for your help.

cooltech77
 
T

Terry Burns

You can't do this with the DataGrid control itself, but here's another
potential solution. If you have fixed number of categories, why not arrange
your page using DIV tags each category should have two DIV Tags, one is
allways visible and the other will display depending on what category
heading is clicked so you can build in the logic to provided a scenario that
when one clicks to expand a section all the others collapse in each
collapsable DIV you place a datagrid and have this display your custom
colums.

If your categories are variable, you could consider building your page
programatically.

You just need to be clever about how you go about servicing the various
events for each grid, just have one event handler for all the grids main
events such as Update, Edit, Delete etc

Just a thought. Also, there may be third party grids which will do what you
want.

HTH
 
G

Guest

Thanks for your reply.My categories are fixed and I just need to show the
data,no Updates or Deletes are allowed so I can use just one datagrid as you
suggested.
My question is,how to associate the DIV tags with the column names from the
database?I can write the DIV tags to expand/hide the column but then how will
I associate it with showing/hiding data from the datagrid? .I am a bit of a
newbie so pardon me if these questions seem basic.

thanks in advance.
cooltech77
 
T

Terry Burns

Sorry, we seem to be at cross purposes here, I now see what you are trying
to acheive, The only way I can think you can do this with the standard
datagrid is to have your category columns headers clickable and then to hide
the relevant columns.
 
G

Guest

ok but the problem is that my cateogry column names are not coming from the
database while its underlying columnsare..Let me explain
I get a bunch of fields showing my expenses ,for example, from the database.
I get the fields as say
CarInsurance,homeInsurance,books,movies,eatingOut,grocery

After getting the fields I decide I want to show Carinsurance and
homeInsurannce under one column heading as Insurance.when i click Insurance
it should expand to show me columns for CarInsurance and HomeInsurance.Then i
decide I want to show eatingOut and Grocery under Category name
FoodExpenses.So these category names are not coming from the database.

So i might have to create DIV tags and associate them with the datagrid
column headings..but the question is how?

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top