473,385 Members | 1,582 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,385 software developers and data experts.

Hiding columns in a Datagrid

Hi,

Iw ant to hide some columns in a datagrid and not sure how to go about
this.
basically, bringing back a DataSet with the following fields:

BS_Key BS_ProductId BS_ProductName

I want to display only the last 2 and hide the key.
I cant change the SQL to bring back only these fields, as I need the
key. The user will be able to double click a row and a new screen will
be displayed containing more details on the selected item, so the key is
required (the two fields are not unique to bring back further data)

Also, is it poissible to change the column names without changing the
DB? (e.g. BS_Product Id would become Product Id)

Currently, I am using a DataSet, then using each row, passing the
seperate columns into a ListView, with is powerful, but painful when
changes are required.

Any help on this is appreciated,

Steven
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
2 1244
Steven Blair wrote:
Hi,

Iw ant to hide some columns in a datagrid and not sure how to go about
this.
basically, bringing back a DataSet with the following fields:

BS_Key BS_ProductId BS_ProductName

I want to display only the last 2 and hide the key.
I cant change the SQL to bring back only these fields, as I need the
key. The user will be able to double click a row and a new screen will
be displayed containing more details on the selected item, so the key is
required (the two fields are not unique to bring back further data)

http://www.syncfusion.com/FAQ/WinFor...c44c.asp#q708q

Also, is it poissible to change the column names without changing the
DB? (e.g. BS_Product Id would become Product Id)


Have a look at DataTable.DataColumn.Caption

Cheers

Arne Janning
Nov 16 '05 #2
Thanks for that, most helpful.

The following code does not seem to work though:

ds.Tables[0].Columns["BSHost_Key"].Caption = "Host Id";

If I return the value, it has "Host Id" but when displayed in the
DataGrid, it is using the actual DB Column name. Any idea why this is
happening ?

Steven

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #3

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

Similar topics

2
by: Kevin | last post by:
Hi Al Can someone tell me how to hide colums in a datagrid. I have a one datagrid that is a master and child and I would like to hide specific columns, how do I do this TI Kevin
1
by: Udi | last post by:
Hi everyone! I have a major problem with the DataGrid control for the Windows Form! I am using the DataAdapter to get data from Sql Server 2000 DataBase and populating a DataGrid with the Table i...
2
by: MrNobody | last post by:
I found some tutorial which had the following example for hiding columns in a DataGrid: ...
0
by: mpriem | last post by:
Hi, I am trying to hide a column in a datagrid I dynamicaly created, but fail to with the following code: .... .... foreach(XmlElement objStorageGroup in objServer.ChildNodes) {...
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...
0
by: klynn | last post by:
I queried a series of fields from a database and passed into a datatable. Then bound this to a datagrid. I need to hide 2 of the colums. This doesnt seem to be working the standard way. (with...
7
by: David Freeman | last post by:
Hi There! Below is my VB.NET code... Dim strSQL As String strSQL = "SELECT , FROM Customers GROUP BY , , " Dim oleConn As OleDbConnection = Nothing
9
by: tshad | last post by:
I have a datagrid that I want to add a new column to. This column will only be visible under certain conditions. So I want to set the column visible=false. Then when the right condition happens...
0
by: Bob Davies | last post by:
Hi I have a webservice that retrieves data from a database, this is then returned to the calling client application built in windows forms within a dataset, however upon attempting to create...
5
by: Rich | last post by:
I have a datagrid that uses a dataview object for its datasource. The dataview contains a unique row identifier column. I don't want to display this column in the datagrid. I need the unique row...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...

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.