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

Home Posts Topics Members FAQ

How to name BoundColumn to set Visible flag in Code Behind?

One can set individual controls in Code Behind by giving the controls ID names and
then declaring corresponding objects for them in Code Behind and then setting Visible
= false or true for each such named control. So far so good.

But with asp:DataGrid and asp:BoundColumn one can not assign an ID to each column
since each column's data row gets reproduced N times for N table rows.

So how to "name" a bound column in order to be able to set the column's visibility in
Code Behind?

I want something like:

ColumnName.Visible = true;

and

ColumnName.Visible = false;

I want to decide at page load time whether particular columns will be visible.

Suggestions?
Nov 20 '05 #1
2 2059
I'm not sure you want to refer Column or Cell. If it's column, you can use

DataGridColumn colName = datagrid.Columns[col_index];

But if it's Cell, it's another story.

"Randall Parker" wrote:
One can set individual controls in Code Behind by giving the controls ID names and
then declaring corresponding objects for them in Code Behind and then setting Visible
= false or true for each such named control. So far so good.

But with asp:DataGrid and asp:BoundColumn one can not assign an ID to each column
since each column's data row gets reproduced N times for N table rows.

So how to "name" a bound column in order to be able to set the column's visibility in
Code Behind?

I want something like:

ColumnName.Visible = true;

and

ColumnName.Visible = false;

I want to decide at page load time whether particular columns will be visible.

Suggestions?

Nov 20 '05 #2
Elton W wrote:
I'm not sure you want to refer Column or Cell. If it's column, you can use

DataGridColumn colName = datagrid.Columns[col_index];

But if it's Cell, it's another story.


Elton,

I do want to refer to columns. But isn't there some way to refer to columns with
logical names rather than indexes?
Nov 20 '05 #3

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

Similar topics

3
by: John | last post by:
The ItemCommand event not getting fired when I add both a BoundColumn and a ButtonColumn to a datagrid. When I add a ButtonColumn by itself, everything works fine, but as soon as I add a...
1
by: Jim Heavey | last post by:
Hello, I have set the visibility property of a BoundColumn in a datagrid to false. At some point in the program I make a determination that I want to set the property of this column to "True", but...
1
by: John | last post by:
I have a panel on a webpage. I use client Javacript to manipulate its visibility using something like: Panel.style.display = 'none'. During a postback, getting the Visible attribute always...
4
by: Kenneth | last post by:
Hi, In a .aspx I have a grid with 8 boundcolumns. In code behind I have two methods and the result from the second method ONLY needs 6 boundcolumns of the 8. Can I make 2 of the boundcolumns...
3
by: Andrea Williams | last post by:
I have a BoundColumn which shows a field called 'IsPrimary'. Straight from the database, the field is a 1 or 0 (bit). But I want to show 'Yes' or 'No' instead. Or better yet, an image only if...
4
by: John E. | last post by:
I have an ASP.NET datagrid with several bound columns. I need to make the header of some of these columns display a string that is generated from the code behind (i.e. a dynamic header). How is...
2
by: tshad | last post by:
Is there a way to call a function from a boundcolumn tag? I have some icons that I set as visible or not depending on values set in my table. I have a Datagrid that I am binding to and after...
1
by: rn5a | last post by:
A DataGrid has a BoundColumn which changes to a TextBox when the DataGrid is in the editable mode. The rest of the columns in the DataGrid are TemplateColumns. There's an EditCommandColumn as well....
0
by: mesut | last post by:
Hi colleagues, I'm confused when to use Boundcolumn and when to use TemplateField in ASPX pages. If I use BoundField control how can I get the field value in code behind? If I use BoundField...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
1
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...
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: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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.