ColumnSpan and FooterStyle attributes

S

Stephen Miller

I have a DataGrid with six columns. In the grid's ItemCreated event, I
am calculating a running total for the 6th column and displaying the
total in the footer. In the footer I want to colspan the first 5
columns and add the text 'total'. For example:

e.Item.Cells(0).Text = "Total"
e.Item.Cells(0).ColumnSpan = 5
e.Item.Cells.RemoveAt(1)
e.Item.Cells.RemoveAt(1)
e.Item.Cells.RemoveAt(1)
e.Item.Cells.RemoveAt(1)

I can then write to the 6th column using the cell index 1 (which I
find a little nonsensical):
e.Item.Cells(1).Text = String.Format("{0:$#,##0.#0}", dTotal)

Now the frustrating thing is that the FooterStyle for column 1 is now
being applied to column 6, which makes the design time positioning of
the ASPX totally dependent on the runtime result of the codebehind.

Ideally, I would like to be able to specify the colspan during design
time. This will also avoid problems if the page developer (not me)
decides to remove a column in design time

I have tried, without success:
<FooterStyle HorizontalAlign="Right" Colspan=5></FooterStyle>
and
<FooterStyle HorizontalAlign="Right" ColumnSpan=5></FooterStyle>

Is this possible?

Thanks,

Stephen
 

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

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top