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

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
 
B

Brian Henry

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
 
E

Eliyahu Goldin

It's a known question. Server-side doesn't know about this sort of
client-side changes.

Eliyahu
 
E

Eliyahu Goldin

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
 
S

Steven Cheng[MSFT]

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
 

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,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top