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

How do I make a column in a Gridview visible after checking a checkbox in ASP.NET?

Hi,

I am new at ASP.NET and I am working on a project that involves using a Checkbox to determine if you want a column to be visible or not. This Column contains database information, being the reason I used a Gridview to populate this data, but at times I only want to see 3 columns and at others I want to see all 6 columns. How do I code this in VB.NET in the code behind for this ASP web form.

Any help would be greatly appreciated!!
Sep 24 '07 #1
1 1430
nateraaaa
663 Expert 512MB
Hi,

I am new at ASP.NET and I am working on a project that involves using a Checkbox to determine if you want a column to be visible or not. This Column contains database information, being the reason I used a Gridview to populate this data, but at times I only want to see 3 columns and at others I want to see all 6 columns. How do I code this in VB.NET in the code behind for this ASP web form.

Any help would be greatly appreciated!!
You can set the Visibility property for each column in your gridview to true or false programmatically.

GridView1.Columns(0).Visible = false
//columns are zero based so your 1st column will be 0 not 1.

Populate the grid as you are now then just hide the columns you don't want the user to see based on what checkboxes have been selected.

Nathan
Sep 24 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: simon | last post by:
I have template column in dataGrid and visible=false. <asp:TemplateColumn visible=false> <ItemTemplate><asp:CheckBox Runat=server ID=chkExists Checked='<%# Container.DataItem( "obstaja" ) % ...
0
by: landesjoe | last post by:
Hi, here's my problem in short: Text boxes in gridview don't seem to hold their value if the column's .Visible property is changed back and forth. I've got a form with a gridview populated from...
8
by: gerry | last post by:
The PagerSettings.Visible property is not being handled properly by the GridView control. The value assigned to this property is not applied until after a postback. Simplest test : .aspx...
1
by: sheenaa | last post by:
Hello Members, I m creating my application forms in ASP.Net 2005 C# using the backend SQL Server 2005. What i have used on forms :: ? On my first form i have used some...
1
by: Neven Klofutar | last post by:
Hi, I have a questin regarding GridView, Template column and Checkbox in it. I'm working on a project that has several "client" applications entering data into DB, and one "admin" application...
0
by: sharonrao123 | last post by:
hello all, I have a parent gridview company and in this one a nested gridview people, Is it possible to allow the user to select one row or multiple rows from the people gridview using a check box...
1
by: Ben | last post by:
Hi, I'm designing a c# page and trying to add a checkbox column to a GridView, I've added a Template Row (as described at: http://aspnet.4guysfromrolla.com/articles/052406-1.aspx) and in the...
3
by: =?Utf-8?B?Um9iZXJ0IFNtaXRo?= | last post by:
Hi, I have a GridView with a checkbox column in it called FromInsight, however this is not bound to the dataset, its value is based on another column from the dataset called sourceid For each...
1
Frinavale
by: Frinavale | last post by:
I'm working on an ASP.NET application using VB.NET for server side code. I have a GridView listing a bunch of stuff. Above the GridView I have a checkbox named "ChkBx_SelectAll". If this...
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: 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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.