Column order and dynamically created columns

M

MattB

Hi. I have a page with a DataGrid on it that I do not want to make
completely dynamic, but I'd like to be able to dynamically insert a
column under certain circumstances. I don't want to make the DataGrid
completely dynamic because this application gets distributed in a
compiled state (no codebehind files) and the people who get it need to
be able change the formatting properties in the aspx pages.

So based on some web articles I've seen on creating DG's dynamically, I
think I can just dynamically add a column, but is there a way I can
position that column between two existing (static bound) columns instead
of just having it end up on the far left?

Thanks!

Matt
 
M

MattB

MattB said:
Hi. I have a page with a DataGrid on it that I do not want to make
completely dynamic, but I'd like to be able to dynamically insert a
column under certain circumstances. I don't want to make the DataGrid
completely dynamic because this application gets distributed in a
compiled state (no codebehind files) and the people who get it need to
be able change the formatting properties in the aspx pages.

So based on some web articles I've seen on creating DG's dynamically, I
think I can just dynamically add a column, but is there a way I can
position that column between two existing (static bound) columns instead
of just having it end up on the far left?

Thanks!

Matt

Whoops - that was easy. I solved it myself. For anyone else wondering,
there's a great little method of the Columns collection called AddAt
that allows you to specify the column position:

Dim Max4Col As New BoundColumn
Max4Col.HeaderText = "Remaining"
Max4Col.DataField = "qty_rem"
ItemGrid.Columns.AddAt(1, Max4Col)

Matt
 

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

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top