If your using the later versions of WC, you could use the wwHTMLHelpers library wich lets you use elements the way you do with the Web Control Framework.
Check out the online help topic Library wwHtmlHelpers for details.
This topic shows how to customize an htmlDataGrid by column but you might also be able to override a cell's rendering with your query, ala the old html grid.
Marty