Solved

DataGrid: Sort columns or hide columns

Posted on 2004-10-10
3
381 Views
Last Modified: 2012-05-05
I'd like to produce a datagrid with two different modes - one mode would be a conventional sort...clicking the column head toggles between ascending/descending sort.

In the other mode clicking the column header of a given column will cause that column to shrink to 10 pixels wide with all cells containing blanks. Click that column again and it toggles to it's regular width and content.

I'm figuring the best way to indicate mode is a checkbox.

It'd be great if shifting between modes didn't require a trip back to the server but first things first.

thankx

0
Comment
Question by:juststeve
3 Comments
 
LVL 2

Accepted Solution

by:
dwcorwith earned 500 total points
ID: 12358768
Try to adjust the properties of your datagrid column something like this:

        Dim l As Button
        If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
            l = CType(e.Item.Cells(12).FindControl("cmdDel"), Button)                            
            l.Attributes.Width = "10"
        End If

Confirm the syntax of L.Attributes.Width.  This references a Column Template in a DataGrid that happens to be a button.  You would reference your column template this is of another type, (not a button).

Hope this helps.
dwcorwith
 Also see:
http://builder.com.com/5100-6373-1049811.html#Listing%20E

I know you are not trying to delete something however see if you can just change the attribute of  a column to do what you want.
 Perhaps you could also do a search at builder.com to find a tutoral.  Nice clear turtorals.
0
 

Author Comment

by:juststeve
ID: 12574550
The question was better handled over in the JavaScript room:

http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_21166530.html
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

Suggested Solutions

Title # Comments Views Activity
Paging GridView 7 48
Binding a check box in an Asp.net DataGrid 4 38
ASP.net Javascript use multiple sliders 2 16
Adware on IIS hosted asp.net website 1 9
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…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

932 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

12 Experts available now in Live!

Get 1:1 Help Now