ColumnSpan and FooterStyle attributes

Discussion in 'ASP .Net Datagrid Control' started by Stephen Miller, Feb 6, 2004.

  1. 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
     
    Stephen Miller, Feb 6, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ajaymehra

    Columnspan in Datagrid ?

    ajaymehra, Feb 6, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,666
    Alvin Bruney [MVP]
    Feb 6, 2004
  2. geronimi
    Replies:
    0
    Views:
    468
    geronimi
    Jan 2, 2006
  3. =?Utf-8?B?THVib21pcg==?=

    GridView - FooterStyle

    =?Utf-8?B?THVib21pcg==?=, May 24, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    610
    =?Utf-8?B?THVib21pcg==?=
    May 24, 2007
  4. Antonio Maciel

    Footerstyle element

    Antonio Maciel, Jul 17, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    138
    Antonio Maciel
    Jul 17, 2003
  5. mary

    Datagrid and ColumnSpan

    mary, Sep 16, 2003, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    121
Loading...

Share This Page