The Incredible Disappearing Table Row

Discussion in 'ASP .Net' started by, May 6, 2005.

  1. Guest


    I needed a GridView with an optional extra row in the THEAD and TFOOT.
    I extended GridView and used Dino Esposito's CreateRow overload
    [] then
    added a new template for the header.

    I overrode CreateChildControls like this

    protected override void CreateChildControls ()

    if (TableHeader != null)

    // childtable
    Table t = (Table)Controls[0];
    GridViewRow row = CreateRow( -1, -1, DataControlRowType.Header,

    System.Web.HttpContext.Current.Trace.Warn("Creating children");

    TemplateContainer c = new TemplateContainer(this);

    TableHeaderCell cell = new TableHeaderCell();
    cell.ColumnSpan = this.Columns.Count;

    row.CssClass = "mainhead";
    t.Rows.AddAt(0, row);

    LiteralControl l =

    This works on the first request, but the table row disappears
    After much tearing of hair, I found out that the control existed until
    GridView.OnPreRender was called.

    Does anyone have any idea why OnPreRender would eat my table row?
    , May 6, 2005
    1. Advertisements

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.

Share This Page