473,394 Members | 1,739 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,394 software developers and data experts.

Add hidden columns - web datagrid

Hello group,
The datagrid I use needs to add a hidden column on demand
(only on certain conditions). The sequence of events would be as below:
1) get the dataset(ds) and bind the datagrid(dg) with
the table corresponding to the ds.
2) Sort the datagrid according to the user selected
columns.

3) Add hidden columns to the datagrid. Here, I am not
sure, how to add hidden columns to the datagrid??

Any help would be great!!

Thanks,
Chris.
Jul 21 '05 #1
4 3321
Hi Chris,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to add hidden columns to a
DataGrid. If there is any misunderstanding, please feel free to let me know.

As far as I know, we can use DataColumn.ColumnMapping = MappingType.Hidden
to achieve this. Here are the steps:

1. Create a new DataColumn object and add to the DataTable.Columns
collection.
2. Set ds.Tables[index].Columns["NewlyAddedCol"].ColumnMapping =
MappingType.Hidden;

Then the columns will be added but not shown in the grid.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #2
Chris,

Not impossible you get an answer here in this newsgroup, so only to give you
an extra possibility, the newsgroups

microsoft.public.dotnet.framework.aspnet.datagridc ontrol
and
microsoft.public.dotnet.framework.aspnet
handles questions as yours,

Maybe you find faster and more answers there?

Cor

"chris" <ch***@nospam.com>
Hello group,
The datagrid I use needs to add a hidden column on demand
(only on certain conditions). The sequence of events would be as below:
1) get the dataset(ds) and bind the datagrid(dg) with
the table corresponding to the ds.
2) Sort the datagrid according to the user selected
columns.

3) Add hidden columns to the datagrid. Here, I am not
sure, how to add hidden columns to the datagrid??

Any help would be great!!

Thanks,
Chris.

Jul 21 '05 #3
Chris,

You got a very nice answer from Kevin when I was answering messages in this
group.

Therefore see my pointing you as existing of those newsgroup for next
problems.

(And when needed because you do not know which is the proper one, you can
maybe crosspost them than to this and those newsgroups, gives you the most
change on answers, crossposting is sending one messages to more newsgroups
in one time)

Cor
Jul 21 '05 #4
on DataGrid ItemBound event hide the column. If you are using auto
generated columns then you must hide every cell of that column:
e.Item.Cells[1].Visible = false;

if you are using column template then just set the column object
visible property to false.
datagrid1.Columns[1].Visible = false;

regards,
hsaleem

"chris" <ch***@nospam.com> wrote in message news:<GAs1d.2484$VV2.2385@trndny06>...
Hello group,
The datagrid I use needs to add a hidden column on demand
(only on certain conditions). The sequence of events would be as below:
1) get the dataset(ds) and bind the datagrid(dg) with
the table corresponding to the ds.
2) Sort the datagrid according to the user selected
columns.

3) Add hidden columns to the datagrid. Here, I am not
sure, how to add hidden columns to the datagrid??

Any help would be great!!

Thanks,
Chris.

Jul 21 '05 #5

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

Similar topics

1
by: CodeToad | last post by:
I am using the DataGrid in a C# prog. I have hidden col0, which is hoolding the PK of the row. How can I retrieve this value when the user clicks the row?
1
by: Maziar Aflatoun | last post by:
Hi everyone, I have the following code and I like to add a hidden field in each row <asp:datagrid id="DataGrid1" style="Z-INDEX: 102; LEFT: 48px; POSITION: absolute; TOP: 40px" runat="server"...
4
by: Maziar Aflatoun | last post by:
Hi everyone, I have the following code and I like to add a hidden field in each row <asp:datagrid id="DataGrid1" style="Z-INDEX: 102; LEFT: 48px; POSITION: absolute; TOP: 40px" runat="server"...
2
by: Not Me | last post by:
Hi, In a datagrid's itemcommand method, I can use DataGridCommandEventArgs/item/cells/text to bring up a specific field from a row that was accessed. However, I wish to lookup data from that...
2
by: Rodusa | last post by:
I have a hidden field inside one datagrid which I can't get to make it keep its state after a postback event. Look field: <input type="hidden" id="TxtHiddenItem_id" name="TxtHiddenItem_id"...
4
by: Nicky | last post by:
hi, all I got another quesiton, in my DataGrid control, I want to have a hidden column which will contian an ID value, I don't want to display this ID value to user, but I need it when user click...
4
by: chris | last post by:
Hello group, The datagrid I use needs to add a hidden column on demand (only on certain conditions). The sequence of events would be as below: 1) get the dataset(ds) and bind the datagrid(dg) with...
0
by: news.microsoft.com | last post by:
I am going crazy trying to figure this out, and I am wondering if this is a bug in the ASP.Net implementation. My situation: I have an ASPX page with 2 different modes: *Mode 1: Datagrid...
2
by: Mark Rae | last post by:
Hi, See the following: http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework/topic38190.aspx This was a particularly useful feature of the old DataGrid control which seems to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
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
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...

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.