473,781 Members | 2,280 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Thanks in advance
Srinivas

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

"srinivas" <sr******@discu ssions.microsof t.comwrote in message
news:61******** *************** ***********@mic rosoft.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.column s(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******@discu ssions.microsof t.comwrote in message
news:61******** *************** ***********@mic rosoft.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.column s(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******@discu ssions.microsof t.comwrote in message
news:F4******** *************** ***********@mic rosoft.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******@discu ssions.microsof t.comwrote in message
news:61******* *************** ************@mi crosoft.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.column s(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******@discu ssions.microsof t.comwrote in message
news:F4******** *************** ***********@mic rosoft.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******@discu ssions.microsof t.comwrote in message
news:61******** *************** ***********@mic rosoft.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.column s(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******@discu ssions.microsof t.comwrote in message
news:11******** *************** ***********@mic rosoft.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******@discu ssions.microsof t.comwrote in message
news:F4******* *************** ************@mi crosoft.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******@discu ssions.microsof t.comwrote in message
news:61******* *************** ************@mi crosoft.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.column s(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
840
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 controlling the visibility of columns in the DataGrid control. The problem usually comes down to one fact. The DataGrid has a property called AutoGenerateColumns. The default value is "True". This means that when AutoGenerateColumns is set to True,...
2
2231
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 to get my expression columns to show up in my GridView. Anybody knows any neat tricks to make this work? Here’s a “step-by-step” to reproduce my worries: 1. Create a new “ASP.NET web site” project
3
14442
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 that I can't seem to resize my dataview's columns which are auto generated. Is there a way to do this? I have tried several different things, but I can't seem to get at the column collection to change the widths? MY development environment
2
1656
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 enter the amount of items being added/removed. When the user clicks the 'Edit' link I want to hide the stock column and display a field for the TransactionAmt. I'm using the RowUpdating event to execute some functions used by that field. I've...
1
1821
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 void gvLocations_edit(object sender, GridViewEditEventArgs e) { // load the record details into the edit fields // GridView gvRecord = (GridView)sender; string sThisRecord = gvRecord.Rows.Cells.Text; ...
2
2911
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 Visible property on the columns it causes the underlying ObjectDataSource to re-issue the Select statement. How can I hide these columns without double clutching the ODS Select?
0
1259
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 follows: public static void ExportExcelFile(Control htmlData, string filename) { HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename="
1
2786
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 will always be there. On the end of the gridview I need to add columns dynamically. These columns may or may not exist and I don't know how many there will be. The way it is currently programmed, there are 2 gridviews, one for viewing a list and...
9
12096
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; e.Row.Cells.Visible = false; but after that paging is not working. I tried another way by using gridview's column.Visible property but its giving error
0
9474
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
10139
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...
1
10075
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
7485
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
6727
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
5373
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
5504
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
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
3
2869
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.