Solved

Gridview and javascript to show/hide columns

Posted on 2009-07-06
6
807 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

729 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