DataTable Column question

M

Mika M

Hello!

I add column into DataTable after table is filled into DataSet like ...

ds.Tables("WorkQueue").Columns.Add("OpenQty", GetType(Integer),
"OrderedQty-PreparedQty")

This column will be the last one, but how can I place it just after
'OrderedQty' 'PreparedQty' columns, because then it's not the last column?
Is this even possible?
 
E

Eric Cadwell

Apply a DataGridTableStyle to the grid:

DataGridTableStyle gridStyle = new DataGridTableStyle();
gridStyle.MappingName = PMProductCollection.TABLE_NAME; //make sure that
this matches the table name
itemsGrid.TableStyles.Add(gridStyle);

//OrderedQty
DataGridColumnStyle dgcs = new DataGridTextBoxColumn();
dgcs.MappingName = OrderedQty;
dgcs.HeaderText = "Quantity Ordered";
//dgcs.ReadOnly = true; ?
gridStyle.GridColumnStyles.Add(dgcs);

//PreparedQty
DataGridColumnStyle dgcs = new DataGridTextBoxColumn();
dgcs.MappingName = PreparedQty;
dgcs.HeaderText = "Quantity Prepared";
//dgcs.ReadOnly = true;
gridStyle.GridColumnStyles.Add(dgcs);

//OpenQty
DataGridColumnStyle dgcs = new DataGridTextBoxColumn();
dgcs.MappingName = OrderedQty;
dgcs.HeaderText = "Quantity Open";
//dgcs.ReadOnly = true;
gridStyle.GridColumnStyles.Add(dgcs);


The order you add column styles to the table style is the order they will be
displayed in.

HTH;
Eric Cadwell
http://www.origincontrols.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top