Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I don't use the datagrid... I don't know , but it may be possible to set the column width to 0 but... forget it...

Never relly on UI (controls) to manipulate this kind of issue.

 

Certainlly you have the DataGrid control bound to a DataTable right?

So, on that DataTable set this:

YourDataTable.Columns("ColumnNameToHide").ColumnMapping = MappingType.Hidden

 

Alex :p

Software bugs are impossible to detect by anybody except the end user.
Posted
I do not use datagrids much either, but I am attempting some manipulations where the datagrid will work really well. I am using a dataview for my datagrid.

____________________________________________

http://www.pophamcafe.com

I am starting a developers section, more tutorials than anything.

Posted

Ok... but your dataview comes from a datatable...

If you use that on the source table of you dataview it should work...

 

Alex :p

Software bugs are impossible to detect by anybody except the end user.
Posted

Try using a DataGridTableStyle.

Use the mapping property of each DataGridTextBoxColumn to map to a certain column.

E.G.

 

DataGridTableStyle dts = new DataGridTableStyle();

DataGridTextBoxColumn textCol = new DataGridTextBoxColumn();

textCol.MappingName = "TaskID";

textCol.HeaderText = "The Task ID";

dts.GridColumnStyles.Add(textCol);

dataGrid1.TablesStyles.Add(dts);

 

Any columns you dont map wont be shown.

Posted

That is an option but we shouldn't relly on a UI Control for this business issue, and this gets more significant if we're talking about the .net DataGrid.

 

If you manage the data from the datasource you can safelly upgrade the UI controls that no damage or recoding will be donne...

 

Alex :p

Software bugs are impossible to detect by anybody except the end user.
Posted
The way to do this is to use the DataGridTableStyle and set the colume width to 0 or just leave the colume out of the table style altogether. Sometimes it is better to set the width to 0 in case you want to access all the data in the datagrid as opposed to its datasource. It depends on your needs.....
Hamlet

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...