Adding items to listbox through java script then accessing through asp.net

  • Thread starter Thread starter Brian Henry
  • Start date Start date
B

Brian Henry

I am trying to add some items to a list box in java script, they add just
fine, the values and text are how they should be. The problem though is when
I try to access these added items from asp.net they do not show up, If i
place a button on the same form that is a server control, click it, i'd
expect the lists to be posted back too... but they dont appear to be because
the collections for the list boxes were empty, how do you get a list box to
post back data that was added through a java script command on the client
side? thanks
 
yes, but how do you deal with posting them back to the server after the
client is done with the data? i have seen commercial asp.net controls
written that do changes client side like this then post back to the
server... so i know it is possible to do this... but how is my question
 
It's a known question. Server-side doesn't know about this sort of
client-side changes.

Eliyahu
 
There are standard ways of passing data from client to server. Most popular
is in <input type=hidden ...>. You can make a string out of the items and
parse it on the server. I won't be surprised if someone will offer a better
idea though.

Eliyahu
 
Hi Brian,

I think Eliyahu's suggestion that use the <input hidden > field is quite
reasonble for your situation and I've also posted my reply and provide some
suggestions in another post titled "Multi list box selector and post back
question". I'd appreciate if you also have a look there .Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
Back
Top