Reputation: 1686
I would like to perform a select statement using a DataContext from the code behind page and then display the results in an HTML table.
Best ways to do this?
Upvotes: 0
Views: 916
Reputation: 14460
If you really need to create html table you can use a literal
in frontend and add the literal text from back end
eg <asp:Literal ID="ltrUser" runat="server"></asp:Literal>
In backend code
if (!IsPostBack)
{
var data = datasource;
ltrUser.Text = "<table><tr><td>";
ltrUser.Text += "<h1>"+ data.name + "</h1>";
ltrUser.Text += "</td></tr></table>";
}
Upvotes: 1
Reputation: 51624
The best way to do this as always depends. One of the fastest and easiest way would be to directly bind the data to a DataGrid.
Upvotes: 2