473,473 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 2886
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: ABC | last post by:
I have an idea. I need to write a common gridview block which contains labels, textboxs, one girdview and some buttons. Then, I think the above block will apply on several girdview with...
5
by: srinivas | last post by:
Hi, I have binded a dataset to a gridview control at run time. I'm fetching 5 columns from the database. But while displaying it on the screen i want to show only 3 columns. I tried with...
0
by: cook.jonathan.m | last post by:
I want to programmatically add a dropdown to each row in a certain column returned to the gridview by my query. I want to do this entirely in behind-code. My gridview tag in the page will have...
5
by: Andrew Robinson | last post by:
I am attempting to better automate a Pager Template within a GridView. I am succesfully skinning a Drop Down List withing my control (the DDL is added to my control). I correctly populate the item...
2
by: =?Utf-8?B?Sm9zaCBTY2htaWR0?= | last post by:
I have a gridview that is being used for managing inventory. The default view shows the stock currently available. When editing I don't want the stock to be directly edited, rather the user will...
3
by: Steve Kershaw | last post by:
Hi, I need a way to bind a DirectoryInfo array to a GridView without any errors. The code I'm using to create the DirectoryInfo array is: // Define the current directory DirectoryInfo dir...
2
by: J055 | last post by:
Hi I need to search a number of DataTables within a DataSet (with some relationships) and then display the filtered results in a GridView. The Columns that need to be displayed come from 2 of...
0
by: hedgracer | last post by:
I have a gridview that has six columns. I need to hide the last column (i.e. not download it) in the download from gridview to excel. My current code (which downloads the entire gridview) is as...
9
by: RobertTheProgrammer | last post by:
Hi all, Hopefully this one is rather simple. I just haven't been able to figure it out. On my GridView I have some hidden key columns which I've hidden by using tha attribute Visible="false"...
9
by: ally | last post by:
Hi, I am programmatically binding gridview to a datatable. I want to hide 2 columns. I can be done by adding code in RowCreated event of gridview like e.Row.Cells.Visible = false; ...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.