467,135 Members | 1,214 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,135 developers. It's quick & easy.

ListBox and Javascript

Hi,

i have a serverside listbox but i modify the value with javascript on the
clientside. On postback my changed/added values are all lost? what am i
doing wrong? Is it not possible to change the listbox content on the
clientside?

regards

henrik
Nov 18 '05 #1
  • viewed: 5102
Share:
4 Replies
you can add the values to a list box using javascript.
alternatively you can keep a hidden textbox and add the value of the item
addded to the listbox as a comma seperated value and get these values at the
server side.
HTH
srini

"Henrik Holle" wrote:
Hi,

i have a serverside listbox but i modify the value with javascript on the
clientside. On postback my changed/added values are all lost? what am i
doing wrong? Is it not possible to change the listbox content on the
clientside?

regards

henrik

Nov 18 '05 #2
Not if the listbox is being re-created from viewstate (which is probably
what's happening). The only solution I know of is when the submit button is
clicked, to highlight all items in the listbox and use good'ol Request.Form
to access the values..

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Henrik Holle" <ho***@folter.org> wrote in message
news:OZ**************@TK2MSFTNGP15.phx.gbl...
Hi,

i have a serverside listbox but i modify the value with javascript on the
clientside. On postback my changed/added values are all lost? what am i
doing wrong? Is it not possible to change the listbox content on the
clientside?

regards

henrik

Nov 18 '05 #3
Are you populating the listbox in the PageLoad method? If so you'll need to test for
postback before populating listbox.

"Henrik Holle" <ho***@folter.org> wrote in message
news:OZ**************@TK2MSFTNGP15.phx.gbl...
| Hi,
|
| i have a serverside listbox but i modify the value with javascript on the
| clientside. On postback my changed/added values are all lost? what am i
| doing wrong? Is it not possible to change the listbox content on the
| clientside?
|
| regards
|
| henrik
|
|

Nov 18 '05 #4
ok, i build a workaround with a hiddenfield and onsubmit/postback i am
parsing the values and add the listitems by hand.

thx for your help
"Clamps" <Cl****@RobotMafia.Futurama.com> schrieb im Newsbeitrag
news:uY**************@TK2MSFTNGP15.phx.gbl...
Are you populating the listbox in the PageLoad method? If so you'll need
to test for
postback before populating listbox.

"Henrik Holle" <ho***@folter.org> wrote in message
news:OZ**************@TK2MSFTNGP15.phx.gbl...
| Hi,
|
| i have a serverside listbox but i modify the value with javascript on
the
| clientside. On postback my changed/added values are all lost? what am i
| doing wrong? Is it not possible to change the listbox content on the
| clientside?
|
| regards
|
| henrik
|
|

Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Janaka | last post: by
4 posts views Thread by collie | last post: by
7 posts views Thread by Lit | last post: by
15 posts views Thread by Doogie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.