Solved

Gridview and javascript to show/hide columns

Posted on 2009-07-06
6
801 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 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