Monday, January 17, 2011

Outputting Tableless HTML Navigation with ASP>NET

If you are reading this, you are probably desperately trying to find a way to implement site navigation in an unordered list. You've probably also wasted several hours on the internet learning the basics of the DataList and DataTable controls built into ASP.NET; only to learn those two controls are contrived in such a way as to only output html in a table based format.

The solution is to use an asp:repeater. Here is a really well written article describing what I agree is the best method for outputting site navigation in an ordered list format.
  1. Output your data to an xml sitemap
  2. Display the sitemap on the page as an unordered list using a Repeater .



No comments: