Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Given a DataSet [ds] that will be used to populate a DataGrid [dgTasks] as DataSource which has the following format:

ds.Tables[0]:

[CLIENT] [ASSIGNMENT] [ELAPSED TIME] [FORMATTED ELAPSED]

Client1 Assignment1 150 XX:XX:XX

Client1 Assignment2 500 XX:XX:XX

Client2 Assignment1 456009 XX:XX:XX

 

In my DataGrid [dgTasks] I want to display the columns [CLIENT], [ASSIGNMENT], and [FORMATTED ELAPSED] therefore omitting the [ELAPSED TIME] column that was used to generate the [FORMATTED ELAPSED] column.

Now if I rememeber correctly it is very difficult to hide a column once the dataset it attached (datasource) to the Datagrid - so I thought of a good solution, delete the column [ELAPSED TIME] after I am done generating the [FORMATTED ELASPED] column.

So - question is simple - either how do I delete an entire column from a DataSet or if anyone has any other suggestions to resolve my dilemna. Thanks,

Posted

Actually it's quite easy to remove a column from a DataGrid if your talking ASP.NET - windows, don't know - but probably similiar:

 

this.dataGrid1.Columns[x].Visible = false;

 

where x is the column you want to hide.

 

Or if the windows control supports it, don't use that column as one of the columns to bind to (ASP supports that, so I imagine in some facit the windows version of the control does too).

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...