Solved

Gridview and javascript to show/hide columns

Posted on 2009-07-06
6
806 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
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!

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
insert value of checklistbox checked 4 39
Iteration Help (Asp.net VB) 5 37
make control visible based off other control value 7 22
aspx ascx, c# 7 20
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 …
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

726 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