473,326 Members | 2,173 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,326 software developers and data experts.

Hiding columns in GridView Control

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 gridview.columns(i).visible property,but it did't work.

Thanks in advance
Srinivas

Aug 3 '06 #1
5 1612
Are you adding the columns your self or using autoGenerate?

"srinivas" <sr******@discussions.microsoft.comwrote in message
news:61**********************************@microsof t.com...
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 gridview.columns(i).visible property,but it did't work.

Thanks in advance
Srinivas

Aug 3 '06 #2
Hi,
Thanks for the response.
I DID NOT ADD ANY COLUMNS TO THE GRID VIEW AT DESIGN TIME OR AT RUN TIME.
In the codebehind i'm just setting the datasource of the grid view as
dataset which contains 5 columns of data.I require all 5 columns of data ,
but while displaying it i want to hide some columns.

Thanks
Srinivas

"Winista" wrote:
Are you adding the columns your self or using autoGenerate?

"srinivas" <sr******@discussions.microsoft.comwrote in message
news:61**********************************@microsof t.com...
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 gridview.columns(i).visible property,but it did't work.

Thanks in advance
Srinivas


Aug 3 '06 #3
You can use the technique in this article...

http://www.netomatix.com/RemoveGridColumn.aspx
"srinivas" <sr******@discussions.microsoft.comwrote in message
news:F4**********************************@microsof t.com...
Hi,
Thanks for the response.
I DID NOT ADD ANY COLUMNS TO THE GRID VIEW AT DESIGN TIME OR AT RUN TIME.
In the codebehind i'm just setting the datasource of the grid view as
dataset which contains 5 columns of data.I require all 5 columns of data ,
but while displaying it i want to hide some columns.

Thanks
Srinivas

"Winista" wrote:
>Are you adding the columns your self or using autoGenerate?

"srinivas" <sr******@discussions.microsoft.comwrote in message
news:61**********************************@microso ft.com...
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 gridview.columns(i).visible property,but it did't work.

Thanks in advance
Srinivas



Aug 4 '06 #4
Hi Winista
Thanks for the URL.
But i'm using ASP.net gridview.
The code that;s given in that url does't fit for it.

Thanks
Srinivas

"Winista" wrote:
You can use the technique in this article...

http://www.netomatix.com/RemoveGridColumn.aspx
"srinivas" <sr******@discussions.microsoft.comwrote in message
news:F4**********************************@microsof t.com...
Hi,
Thanks for the response.
I DID NOT ADD ANY COLUMNS TO THE GRID VIEW AT DESIGN TIME OR AT RUN TIME.
In the codebehind i'm just setting the datasource of the grid view as
dataset which contains 5 columns of data.I require all 5 columns of data ,
but while displaying it i want to hide some columns.

Thanks
Srinivas

"Winista" wrote:
Are you adding the columns your self or using autoGenerate?

"srinivas" <sr******@discussions.microsoft.comwrote in message
news:61**********************************@microsof t.com...
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 gridview.columns(i).visible property,but it did't work.

Thanks in advance
Srinivas



Aug 4 '06 #5
The same approach works for GridView. GridView also has RowDataBound and
RowCreated events and you will use the same technique to remove the cell
from row.
"srinivas" <sr******@discussions.microsoft.comwrote in message
news:11**********************************@microsof t.com...
Hi Winista
Thanks for the URL.
But i'm using ASP.net gridview.
The code that;s given in that url does't fit for it.

Thanks
Srinivas

"Winista" wrote:
>You can use the technique in this article...

http://www.netomatix.com/RemoveGridColumn.aspx
"srinivas" <sr******@discussions.microsoft.comwrote in message
news:F4**********************************@microso ft.com...
Hi,
Thanks for the response.
I DID NOT ADD ANY COLUMNS TO THE GRID VIEW AT DESIGN TIME OR AT RUN
TIME.
In the codebehind i'm just setting the datasource of the grid view as
dataset which contains 5 columns of data.I require all 5 columns of
data ,
but while displaying it i want to hide some columns.

Thanks
Srinivas

"Winista" wrote:

Are you adding the columns your self or using autoGenerate?

"srinivas" <sr******@discussions.microsoft.comwrote in message
news:61**********************************@microso ft.com...
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 gridview.columns(i).visible property,but it did't work.

Thanks in advance
Srinivas




Aug 4 '06 #6

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

Similar topics

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...
2
by: Kjetil Klaussen | last post by:
Hi, I’m having some troubles trying to bind my dataset to a GridView control through an ObjectDataSource control. The binding works fine for regular columns in my dataset, but I can’t seem...
3
by: BartMan | last post by:
Greetings, I have a gridview which is sitting on a multi view control (witin a view), and it is bound to a dataset which I dynamically apply to the control within asp.net page. The problem is...
2
by: =?Utf-8?B?Sm9zaCBTY2htaWR0?= | last post by:
I have a gridview that is being used for managing inventory. The default view shows the stock currently available. When editing I don't want the stock to be directly edited, rather the user will...
1
by: Dica | last post by:
i need to allow the user to select a row from my dataGrid for editing. as such, i include the record ID in the first column and then extract like so when retrieving the record details: protected...
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...
0
by: hedgracer | last post by:
I have a gridview that has six columns. I need to hide the last column (i.e. not download it) in the download from gridview to excel. My current code (which downloads the entire gridview) is as...
1
by: jimmysjams | last post by:
I'm modifying someone else's code and I have hit a snag. I don't want to rewrite what's already there but I might have to. I have a gridview, in the gridview is a set number of columns that...
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.