469,951 Members | 2,744 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,951 developers. It's quick & easy.

Hiding GridView Columns without Re-Firing ObjectDataSource Select

Based on wether a row is selected in a GridView I need to HIDE the last two
columns of a gridview. I do NOT need to make the cells invisible I want to
hide the entire column.

When I set the Visible property on the columns it causes the underlying
ObjectDataSource to re-issue the Select statement.

How can I hide these columns without double clutching the ODS Select?
Nov 13 '07 #1
2 2722
Loop through the Rows collection and hide the cell for the column in every
row individually. Don't forget the header.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Jay Pondy" <jp****@AugustaNewsprint.comwrote in message
news:8A**********************************@microsof t.com...
Based on wether a row is selected in a GridView I need to HIDE the last
two
columns of a gridview. I do NOT need to make the cells invisible I want
to
hide the entire column.

When I set the Visible property on the columns it causes the underlying
ObjectDataSource to re-issue the Select statement.

How can I hide these columns without double clutching the ODS Select?

Nov 14 '07 #2
Hi jpondy,

From your description, you want to hide some certain columns in GridView
when a certain Row is selected, correct?

As for the columns, do you mean only the columns belongs to that selected
row or those columns for all the row? Yes, I agree that hiding the column
through Column.Visible is not a good approach. If you just want to hide
those columns for the selected row, you can use RowCreated event and if the
row is the selected one(make the certain columns cell invisible(set the css
style "display" to "none"). If you want the entire column to be
invisible, you can set each column cell(of each row) of that certain column
to invisible(through CSS style). How do you think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
>X-WBNR-Posting-Host: 204.19.151.8
From: =?Utf-8?B?SmF5IFBvbmR5?= <jp****@AugustaNewsprint.com>
Subject: Hiding GridView Columns without Re-Firing ObjectDataSource Select
Date: Tue, 13 Nov 2007 13:55:01 -0800

Based on wether a row is selected in a GridView I need to HIDE the last
two
>columns of a gridview. I do NOT need to make the cells invisible I want
to
>hide the entire column.

When I set the Visible property on the columns it causes the underlying
ObjectDataSource to re-issue the Select statement.

How can I hide these columns without double clutching the ODS Select?
Nov 14 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by srinivas | last post: by
reply views Thread by cook.jonathan.m | last post: by
5 posts views Thread by Andrew Robinson | last post: by
2 posts views Thread by =?Utf-8?B?Sm9zaCBTY2htaWR0?= | last post: by
3 posts views Thread by Steve Kershaw | last post: by
reply views Thread by hedgracer | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.