Solved

Gridview and javascript to show/hide columns

Posted on 2009-07-06
6
804 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

791 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