0

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?

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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>";
        }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.