Add value to Dropdownlist using javascript.

R

ritskits

I have the dropdownlist that is populated when the form is loaded.
I have the button that opens search child window using the
modalwindowdialog and it returns the value that I want to add to the
dropdownlist on the parent window using the javascript as there will
not be any event fired when the childwindow is closed.

function GetMeds()
{
var MedsString = window.showModalDialog("SearchColor.aspx", window,
"dialogHeight: 700px; dialogWidth: 700px; edge: Raised; center: No;
help: Yes; resizable: Yes; status: Yes;");

if(MedsString)
{

var ddvalue = MedsString.substring(0,MedsString.indexOf('~'));
var ddtext = MedsString.substring(MedsString.indexOf('~~')+2);
return false;

}

}

I want to add the above ddvalue and the ddtext to the dropdownlist
ddlColor on the aspx page.

Any suggestions will be helpful.

Thanks,
 

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

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top