DropDownList

A

Ana Rita

Hello to all.

I´m trying to use a string, to build the ListItem's of a
DropDownList.

I declare a Public str as string in the webform1.aspx.vb,
and in the page load I build the string like this:

str = "<asp:ListItem value='0'>Blue</asp:ListItem>
<asp:ListItem value='1'>Red</asp:ListItem>"

In the webform1.aspx, html mode, I call the str within the
tag <asp:DropDownList>, like this <%str%>. As I expected,
it gives an error, saying that I can't use this type of
calls.

I want to Know, if it's possible to do something like we
do in asp to build a select object using a string with the
<options>.

Thank you all.

Best wishes.

Ana Rita
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top