Align one Datagrid column

K

kieran

Hi,

I have the following datagrid with manually entered rows. I want to
align the values of the second column only - 'more tax' - to the
center, but i can not seem to do this. The first column i want left
aligned - as is. I can align both columns any way together but not one
on its own.

I can not use the property builder of the datagrid as the columns are
not listed in this as the dg columns are created from a datatable.

Anybody any ideas - all help appreciated.

Thanks.

---------------------------------------


dt = New DataTable("Deductions")

dt.Columns.Add("Deduction", GetType(System.String))

dt.Columns.Add("Value", GetType(System.String))

Dim dr As DataRow = dt.NewRow

dr(0) = "TAX"

dr(1) = (split(7))

dt.Rows.Add(dr)

Dim dr1 As DataRow = dt.NewRow

dr1(0) = "More TAX"

dr1(1) = (split(9))

dt.Rows.Add(dr1)



Datagrid1.DataSource = dt

Datagrid1.DataBind()
 
P

Phil G.

Hi Kieran,

Sorry it's a rather incomplete answer but there is a class,
DataGridColumnStyle that has an alignment property for text in a column. I'm
sure you can search the net for an example.

HTH.

Regards,

Phil
 

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