473,804 Members | 2,191 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to hide column in autogenerated DataGRID ?!?!?!

jax
Hi All developers !

I have a datagrid which autogenerates columns by the
sql SELECT list... The list (for some reasons) must be the
same. So my question is

HOW TO MOVE OUT A COLUMN
FROM AUTOGENERATED DATAGRID?

I would really appreciated answer with some code ! :))

THANK YOU ALL !!!
Nov 18 '05 #1
2 2437
Here's a good article that addresses your question:

http://www.c-sharpcorner.com/Code/20...ridColDyna.asp
--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com
"jax" <su********@yah oo.com> wrote in message
news:c4******** **@bagan.srce.h r...
Hi All developers !

I have a datagrid which autogenerates columns by the
sql SELECT list... The list (for some reasons) must be the
same. So my question is

HOW TO MOVE OUT A COLUMN
FROM AUTOGENERATED DATAGRID?

I would really appreciated answer with some code ! :))

THANK YOU ALL !!!

Nov 18 '05 #2
One way is to make that column invisible at ItemDataBound of the datagrid, like this (vb syntax)

Private Sub grdTest_ItemDat aBound(ByVal sender As Object,
ByVal e As System.Web.UI.W ebControls.Data GridItemEventAr gs)
Handles grdTest.ItemDat aBoun

e.Item.Cells(My ColumnIndex).Vi sible = Fals

End Su

If you were not autogenerating the columns, you could use .findcontrol to get the id, but I don't think you can set the id for autogenerated

hth

Bil

----- jax wrote: ----

Hi All developers

I have a datagrid which autogenerates columns by th
sql SELECT list... The list (for some reasons) must be th
same. So my question i

HOW TO MOVE OUT A COLUM
FROM AUTOGENERATED DATAGRID

I would really appreciated answer with some code ! :)

THANK YOU ALL !!

Nov 18 '05 #3

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

Similar topics

6
8418
by: Das | last post by:
Hi everyone, I'm using datagrid control to display the data. I want to hide column to be displayed into the data grid. I'm using the code as given below: Method given below is used to bind the data grid with the db: public static void DataGrid(DataGrid DG,string sql) { //Initialize connection with the db
3
4077
by: McNutt Consulting | last post by:
I'm trying to implement a datagrid with dynamically created columns. The data is coming out of a very simple XML file, and it's bound through a dataview. The datagrid is just a shell definition with no column definitions in the ..aspx file. The grid is binding fine with all the data being displayed, but my numeric columns aren't being formatted. I'm using the "dataformattextstring", but it doesn't seem to be working. Is there...
2
403
by: jax | last post by:
Hi All developers ! I have a datagrid which autogenerates columns by the sql SELECT list... The list (for some reasons) must be the same. So my question is HOW TO MOVE OUT A COLUMN FROM AUTOGENERATED DATAGRID? I would really appreciated answer with some code ! :))
8
7321
by: Hanson | last post by:
I have a datagrid control in an aspx page. The datagrid columns will be dynamically generated according to the pre-page's search condition, I want to hide some columns in the datagrid. is that anyway to do that?
7
1007
by: ruca | last post by:
Hi, I want to set visible to false in my datagrid to all fields that are an ID. How can I do this? I'm using ItemDataBound event but it gives me an error: "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" I have this code:
7
3766
by: Rob | last post by:
Does anyone know how I could hide a column in a DataGrid? To make the problem harder I am using AutoGenerateColumns="True" so I don't know how to find the control using document.getElementById(ControlID) and then hiding it by using display:none; Anyone have any suggestions? Thanks for the help.
9
6108
by: Steve | last post by:
How I can remove an AutoGenerated column? I wnat to inlcude the primary key in the resultset for creating some custom LinkButtons, but I don't want it (the PK) displayed in the DataGrid. I tried searching the columnheader text, but found that AutoGenerated columns are members of the Columns collection. From the msdn documentation: Note: When the AutoGenerateColumns property is set to true, the columns created by the DataGrid control are...
10
2356
by: Nick | last post by:
Hello, Please pardon my ignorance as I'm sure this is easy to do. I have a datagrid where I want to let the user delete columns. I added a context menu to the datagrid that has a delete option. If the user right clicks on a column heading can I highlight that column and then delete it? I'm not exactly sure how to highlight it or figure out what column has been clicked. In my testing so far when I use the context menu I always get the...
3
7195
by: Jason | last post by:
How do I hide a column in a GridView in ASP.NET 2.0 when all of the columns are autogenerated based on the datasource? I want to hide the first of three columns, but the following doesn't work: DataTable dt = new DataTable(); DataColumn dc; dc = new DataColumn(); dc.ColumnName = "blog_entry_id"; dc.DataType = System.Type.GetType("System.Int32"); dt.Columns.Add(dc);
4
2922
by: gane | last post by:
Hi, I am creating datagrid bound column dynamically and need to check if a datagrid column already exists?Is there a way to check this? thanks gane
0
9595
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
10603
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...
0
10353
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10099
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6869
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
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
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4314
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
3836
muto222
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.