I have a GridView control which is bound to a Stored Procedure (SP) using a
SQLDataSource. The problem I'm having is that the SP returns 4 known columns
and x amount of unknown columns.
I can use the AutoGenerateColumns feature to render all the returned columns
but I'm then having problems adding in 1 column at the right of the GridView
at runtime. This is because AutoGenerated columns aren't added to the
GridView's columns collection so any column created programmatically is
inserted at the start (first column in GridView).
If I disable AutoGenerateColumns, I can declaretively create the first 4
columns as I know what they are but there can be anywhere between 1-18
additional columns after this, with unknown column names (it's a crosstab
SP). With this method, I can't think of a way to find out how many "extra"
columns there are and programmatically create them.
Any advise/inspiration appreciated on how to approach this using either;
AutoGeneratedColumns and inserting a column at the end of the GridView
programmatically,
or,
Not using AtuoGeneratedColumns, declaretively creating the first 4 columns
and then programmatically creating the x amount of columns.
Thanks in advance.