how to bind 3 list items in the asp.net dropdownlist using Javascript

Posted by Macson under JavaScript on 7/3/2009 | Views : 6201 | Status : [Member] | Replies : 1
how to bind 3 list items in the asp.net dropdownlist using Javascript




Responses

Posted by: Vuyiswamb on: 7/6/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Good Day

It can be done this way

script type="text/javascript">

function AddItem(Text,Value)
{
// Create an Option object var opt = document.createElement("option");

// Add an Option object to Drop Down/List Box
document.getElementById("DropDownList").options.add(opt); // Assign text and value to Option object
opt.text = Text;
opt.value = Value;

}<script />


Thank you for posting at DotnetFunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Macson, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response