By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,384 Members | 714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,384 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Nov 18 '05 #1
Share this Question
Share on Google+
5 Replies


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

Eliyahu

"Brian Henry" <br**********@newsgroups.nospam> wrote in message
news:uX**************@TK2MSFTNGP12.phx.gbl...
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

Nov 18 '05 #2

P: n/a
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
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
It's a known question. Server-side doesn't know about this sort of
client-side changes.

Eliyahu

"Brian Henry" <br**********@newsgroups.nospam> wrote in message
news:uX**************@TK2MSFTNGP12.phx.gbl...
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


Nov 18 '05 #3

P: n/a
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

"Brian Henry" <br**********@newsgroups.nospam> wrote in message
news:ev**************@TK2MSFTNGP10.phx.gbl...
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
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
It's a known question. Server-side doesn't know about this sort of
client-side changes.

Eliyahu

"Brian Henry" <br**********@newsgroups.nospam> wrote in message
news:uX**************@TK2MSFTNGP12.phx.gbl...
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



Nov 18 '05 #4

P: n/a
hey, its a start :) an idea is better then no idea

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:uI**************@TK2MSFTNGP11.phx.gbl...
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

"Brian Henry" <br**********@newsgroups.nospam> wrote in message
news:ev**************@TK2MSFTNGP10.phx.gbl...
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
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
It's a known question. Server-side doesn't know about this sort of
client-side changes.

Eliyahu

"Brian Henry" <br**********@newsgroups.nospam> wrote in message
news:uX**************@TK2MSFTNGP12.phx.gbl...
> 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
>
>



Nov 18 '05 #5

P: n/a
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

Nov 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.