473,416 Members | 1,565 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Hiding Columns

Hi Al

Can someone tell me how to hide colums in a datagrid. I have a one datagrid that is a master and child and I would like to hide specific columns, how do I do this

TI
Kevin
Nov 15 '05 #1
2 2104
If this is for an ASP.NET DataGrid ( you didn't say in your post), then here
is the text straight from out of the help collection:

Use the DataGridColumnCollection to programmatically manage a collection of
DataGridColumn derived column objects. These objects represent the columns
in a DataGrid control. You can add, remove, or insert columns into the
DataGridColumnCollection.

Note When the AutoGenerateColumns property is set to true, the columns
created by the DataGrid control are not added to the Columns collection.
The DataGrid control does not store the contents of its Columns collection
into the view state. To add or remove a column dynamically, you must
programmatically add or remove the column everytime the page is refreshed.
Provide a Page_Init function that adds or removes the column before the
DataGrid control's state is reload and the control is rebuilt. Otherwise,
the changes to the Columns collection are not reflected in the DataGrid
control when it is displayed.

Note Although you can programmatically add columns to or remove columns
from the Columns collection of the DataGrid control, it is easier to list
the columns statically and then use the Visible property to display or hide
each column.
The order of the columns in the collection determines the order that the
columns are displayed in the DataGrid control.

The following table lists the different column classes that derive from the
DataGridColumn class. .......

Peter

"Kevin" <an*******@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
Hi All

Can someone tell me how to hide colums in a datagrid. I have a one datagrid that is a master and child and I would like to hide specific
columns, how do I do this?
TIA
Kevin

Nov 15 '05 #2
Kevin wrote:
Hi All

Can someone tell me how to hide colums in a datagrid. I have a one datagrid that is a master and child and I would like to hide specific columns, how do I do this?

If windows forms, get the grid table style, drill down to the
appropriate column style, and set its width to 0!

/steveA
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: c.anandkumar | last post by:
Hi All - I have some problems getting a small piece of javascript working correctly for Firefox. Here is what I am trying to do - 1. I have a form (like a search form) 2. I have many groups...
4
by: Alan Seunarayan | last post by:
Hello, I have a number of ColumnHeaders that are 'hidden' (width set to zero). However, it is still possible to size them. The reason why they are hidden is to give the illusion that they do...
2
by: MrNobody | last post by:
I found some tutorial which had the following example for hiding columns in a DataGrid: ...
1
by: Amber | last post by:
The DataGrid allows you to make columns visible or invisible on demand - even edit and other special columns. This article will show you how it is done. Some developers have reported problems...
5
by: Rich | last post by:
I have a datagrid that uses a dataview object for its datasource. The dataview contains a unique row identifier column. I don't want to display this column in the datagrid. I need the unique row...
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...
1
by: jack | last post by:
Hi all, My datagrid have too many columns which are going out of screen. one of the solution is to group the columns and make only the total column visible at the initial stage. What now i...
2
by: =?Utf-8?B?SmF5IFBvbmR5?= | last post by:
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...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
0
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: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.