0

I'm creating a web page which gets records from a database, these records are mapped as dictionary. I want to be able to dynamically create a structure as follows

<ul>
<li>row.GetString("firstname")</li>
<li>row.GetStrin("lastname")</li>
</ul>

so far i have mapped the results and i am looping each record please can some one help me with how i may be able to dynamically create html using c#

1
  • 1
    Correct me if I'm wrong but you may use BulletedList control. Commented Feb 1, 2012 at 8:48

2 Answers 2

2

What about an ASP.NET repeater?

PD: Check the sample in this MSDN article and you'll get instructed in how to use it.

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

Comments

1

First drop an asp label in the place where you want your list to appear. This is assuming that you're looping through a datatable:

YourLabel.Text = "<ul>";
foreach (DataRow row in table.Rows) {
    YourLabel.Text += "<li>" + row["firstname"] + "</li>";
    YourLabel.Text += "<li>" + row["lastname"] + "</li>";
}
YourLabel.Text += "</ul>";

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.