Solved

Gridview and javascript to show/hide columns

Posted on 2009-07-06
6
802 Views
Last Modified: 2012-05-07
Hello,

I am planning to create a gridview that has too many columns to display all of them at one time.

I thought that I could hide certain columns by setting the width property to 0 and show others by setting the width property to auto. Then I was hoping that I could add some buttons that would call a javascript function to set new values for the column widths (0 and auto) in order to show/hide another set of columns.

My thinking is that by doing this clientside, the current sorting and place in the table is maintained, but the user is able to see different sets of columns in the table.

Can you please point me to an example of this or let me know of a better way of doing this?

Thanks very much,
-Bill
0
Comment
Question by:Bill732
  • 4
  • 2
6 Comments
 
LVL 8

Expert Comment

by:MrAgile
ID: 24790178
Hi There,

So you want to be able to hide / show certain columns for different users? Hiding and showing the columns on a gridview using javascript is easy, maintaining state for each user will be the tricky part (if thats what you intend to do).

I use a javascript framework called jquery. www.jquery.com which has built in hide show functions to do this.

Let me know if you need any further clarification.

Sean
0
 

Author Comment

by:Bill732
ID: 24793898
Thanks for responding so quickly. No, I don't need to hide / show for different users. I just want them to be able to toggle between hiding / showing different sets of columns that fit nicely on the page, while at the same time keeping the sorting and cursor position of where they are at the time. They can pick a different set of columns and sort on one of those, etc.

Someone else I know said that he really likes jquery too, but I hadn't looked into it yet.

Thanks for letting me know.
0
 

Author Comment

by:Bill732
ID: 24794251
Do you happen to know of some good places to look for gridview manipulation like this using jquery?

Thanks,
-Bill
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 8

Accepted Solution

by:
MrAgile earned 500 total points
ID: 24800490
hi There,

It's easy to show and hide columns if that's what your asking? Otherwise have a  look at this http://www.google.com.au/search?q=gridview+and+jquery&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

Does this help you?

Sean
0
 

Author Comment

by:Bill732
ID: 24825935
Thanks Sean, I'll check out the jquery tutorials, etc. I haven't used it before, but have heard good things about it.
0
 

Author Closing Comment

by:Bill732
ID: 31600229
Thanks Sean, I'll check out the jquery tutorials, etc. I haven't used it before, but have heard good things about it.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now