473,725 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3343
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 misunderstandin g, please feel free to let me know.

As far as I know, we can use DataColumn.Colu mnMapping = MappingType.Hid den
to achieve this. Here are the steps:

1. Create a new DataColumn object and add to the DataTable.Colum ns
collection.
2. Set ds.Tables[index].Columns["NewlyAdded Col"].ColumnMapping =
MappingType.Hid den;

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.publi c.dotnet.framew ork.aspnet.data gridcontrol
and
microsoft.publi c.dotnet.framew ork.aspnet
handles questions as yours,

Maybe you find faster and more answers there?

Cor

"chris" <ch***@nospam.c om>
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.Colum ns[1].Visible = false;

regards,
hsaleem

"chris" <ch***@nospam.c om> wrote in message news:<GAs1d.248 4$VV2.2385@trnd ny06>...
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
1350
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
5417
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" AutoGenerateColumns="False" > <Columns> <asp:TemplateColumn> <ItemTemplate>
4
1701
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" AutoGenerateColumns="False" > <Columns> <asp:TemplateColumn> <ItemTemplate>
2
2654
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 row, that is in a hidden field on the datagrid. How can I do this? I would appreciate a simple answer (if one exists) as you may notice I'm new to this :p
2
4245
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" runat="server" value='<%# DataBinder.Eval(Container, "DataItem.item_id").ToString() %>'> I can get around that using an asp.net textbox control, but it doesn't
4
1433
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 it. The problem I got is when I uncheck the "visible" checkbox, it seems DataGrid does not render it at all. So how to do this hidden column? Thanks
4
305
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 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??
0
1178
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 with no footer *Mode 2: Datagrid with a footer template containing a textbox and an "Add Record" command (also has an edit column)
2
1807
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 be missing from the new GridView control What is the "preferred" method of doing this in a GridView?
0
8752
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9179
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6702
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4519
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3228
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 we have to send another system
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.