HighTechTalks DotNet Forums  

add option

Dotnet Scripting microsoft.public.dotnet.scripting


Discuss add option in the Dotnet Scripting forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Vik
 
Posts: n/a

Default add option - 09-20-2005 , 02:47 PM






I need to add/remove the items from the dropdownlists/listboxes. I tried the
following code:
document.getElementById("ListBox1").add(new Option("5","5"));
The code adds the new item for a moment (I can see it in the listbox and can
retrieve it by the code) but then the new items disappears from the listbox.

How can I fix it?

Thanks.



Reply With Quote
  #2  
Old   
Vik
 
Posts: n/a

Default Re: add option - 09-20-2005 , 02:53 PM






Forgot to mension that this code is on an .aspx page.

Vik

"Vik" <viktorum@==yahoo.com==> wrote

Quote:
I need to add/remove the items from the dropdownlists/listboxes. I tried
the following code:
document.getElementById("ListBox1").add(new Option("5","5"));
The code adds the new item for a moment (I can see it in the listbox and
can retrieve it by the code) but then the new items disappears from the
listbox.

How can I fix it?

Thanks.





Reply With Quote
  #3  
Old   
Bruce Barker
 
Posts: n/a

Default Re: add option - 09-21-2005 , 04:15 PM



they will stay until you postback. you will need to recreate on the postback
render.

-- bruce (sqlwork.com)


"Vik" <viktorum@==yahoo.com==> wrote

Quote:
I need to add/remove the items from the dropdownlists/listboxes. I tried
the following code:
document.getElementById("ListBox1").add(new Option("5","5"));
The code adds the new item for a moment (I can see it in the listbox and
can retrieve it by the code) but then the new items disappears from the
listbox.

How can I fix it?

Thanks.





Reply With Quote
  #4  
Old   
Vik
 
Posts: n/a

Default Re: add option - 09-21-2005 , 04:25 PM



You are right. I already figured this out. I run this code by a button that
caused the postback.

Thank you.

Vik

"Bruce Barker" <brubar_nospamplease_ (AT) safeco (DOT) com> wrote

Quote:
they will stay until you postback. you will need to recreate on the
postback render.

-- bruce (sqlwork.com)


"Vik" <viktorum@==yahoo.com==> wrote in message
news:uvrR9LhvFHA.3984 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
I need to add/remove the items from the dropdownlists/listboxes. I tried
the following code:
document.getElementById("ListBox1").add(new Option("5","5"));
The code adds the new item for a moment (I can see it in the listbox and
can retrieve it by the code) but then the new items disappears from the
listbox.

How can I fix it?

Thanks.







Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.