Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / June 2005

Tip: Looking for answers? Try searching our database.

Please help : Add value to dropdownlist using the javascript

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ritskits@yahoo.com - 07 Jun 2005 03:40 GMT
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,
Bert Evans - 10 Jun 2005 18:59 GMT
function addOption(theSelect, theText, theValue) {
    var newOption = new Option(theText, theValue) ;
    var selectLength = theSelect.length ;
    theSelect.options[selectLength] = newOption ;
}

Add the above function to your script then add this line to your code:

addOption(ddlColor, ddText, ddValue) ;

Bert Evans

> I have the dropdownlist that is populated when the form is loaded.
> I have the button that opens search child window using the
[quoted text clipped - 25 lines]
>
> Thanks,

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.