Insert html list of items from database
2 answers
You can use Literal, build HTML for the list and set .Text from Literal.
You can either copy the HTML for the list manually or you can create a Listbox in C # and use something like this to have C # export the HTML string to Literal.
+1
source to share
There are two ways to do this that I can think of:
First, you can put a tag <asp:Placeholder />
on the page and create a list in code:
var select = new HtmlSelect() { Size = 5 };
//assuming the data has been placed in an IEnumarble
foreach (var item in items)
{
select.Items.Add(new ListItem() { Value = item });
}
selectPlaceholder.Controls.Add(select);
Second, you can create a WebService or ashx handler to provide data and populate a list from javascript.
0
source to share