This is a migrated thread and some comments may be shown as answers.

how to make tfoot render last?

2 Answers 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
TigerCoder
Top achievements
Rank 1
TigerCoder asked on 24 Oct 2008, 07:09 PM
How do I make the tfoot tag render last in the html output?

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 27 Oct 2008, 07:20 AM
Hello TigerCoder,

According to the XHTML standard TFOOT section in tables should be rendered after THEAD and before TBODY.

Sincerely yours,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
TigerCoder
Top achievements
Rank 1
answered on 24 Nov 2008, 12:54 PM
That's true. Thanks for the info. For completeness, here is my solution:

In my case, I am using the RadGrid to generate HTML that I save to disk and then, I use a PDF server that I point at the URL so generating valid XHTML is not important to me.

The RadGrid seems to fix this in it's own PDF rendering but since I want to render full reports with lots of different kinds of output, this didn't fit for all the rest of the items I have to render.

I am using the footer to display the footnotes as a table should. Normally, I override the footer render method and write the footnote string to that cell like so:

//rgReport is my radgrid  
//_sFootnotes is a string with my footnotes separated by html breaks  
rgReport.ItemCreated += new GridItemEventHandler(rgReport_ItemCreated);  


void rgReport_ItemCreated(object sender, GridItemEventArgs e)  
{  
    if(e.Item.ItemType == GridItemType.Footer)  
    {  
       e.Item.SetRenderMethodDelegate(new RenderMethod(GridFooterRenderMethod));   
    }  
}   
 
private void GridFooterRenderMethod(HtmlTextWriter writer, Control ctl)   
{  
    // ctl is the footer row and the begin tag has been rendered at this point   
    rgReport.FooterStyle.AddAttributesToRender(writer);  
    TableCell tcFooter = new TableCell();   
    tcFooter.ColumnSpan = rgReport.MasterTableView.Columns.Count;  
    tcFooter.Controls.Add(new LiteralControl(_sFootNotes));  
    tcFooter.RenderControl(writer);  
}  
 

 

I solved the original problem that I had by setting showfooter to false and adding the footer to the grid's controls collection when I am rendering this way:

 

rgReport.ShowFooter = false;  
 
rgReport.Controls.Add(new LiteralControl(_sFootNotes));  

 

 

 

Tags
Grid
Asked by
TigerCoder
Top achievements
Rank 1
Answers by
Vlad
Telerik team
TigerCoder
Top achievements
Rank 1
Share this question
or