Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding <asp:ListItem> to <asp:dropdown> from Javascript

Status
Not open for further replies.

brucegonewild

Programmer
Jan 25, 2008
22
CA
hey there,
So I have this javascript function that does an Ajax call to get a bunch of data... this part is fine...

I get the following (from my ajax-responseText), and I thought I could simply populate my drop-down by setting its innerHtml (or innerText) to responseText... no luck.
here's what I have:

my drop down definition:
Code:
<asp:DropDownList ID='ddlFromToList' runat='Server' Width='227px'>
</asp:DropDownList>

After an event, I get the following text and I want to populate my drop down with it:
Code:
<asp:ListItem value='1' Text='text1'></asp:ListItem>
<asp:ListItem value='2' Text='text2'></asp:ListItem>
<asp:ListItem value='3' Text='text3'></asp:ListItem>

How do I make it (in my javascript) so, the drop-down contains the above <asp:listItems>s?

cheers!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top