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

Discussion in 'ASP .Net' started by Brian Henry, Aug 2, 2004.

  1. Brian Henry

    Brian Henry Guest

    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
    Brian Henry, Aug 2, 2004
    #1
    1. Advertising

  2. Brian Henry

    Brian Henry Guest

    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" <> wrote in message
    news:%...
    > It's a known question. Server-side doesn't know about this sort of
    > client-side changes.
    >
    > Eliyahu
    >
    > "Brian Henry" <> wrote in message
    > news:...
    > > 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
    > >
    > >

    >
    >
    Brian Henry, Aug 2, 2004
    #2
    1. Advertising

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

    Eliyahu

    "Brian Henry" <> wrote in message
    news:...
    > 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
    >
    >
    Eliyahu Goldin, Aug 2, 2004
    #3
  4. Brian Henry

    Brian Henry Guest

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

    "Eliyahu Goldin" <> wrote in message
    news:uIlyd$...
    > 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" <> wrote in message
    > news:...
    > > 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" <> wrote in message
    > > news:%...
    > > > It's a known question. Server-side doesn't know about this sort of
    > > > client-side changes.
    > > >
    > > > Eliyahu
    > > >
    > > > "Brian Henry" <> wrote in message
    > > > news:...
    > > > > 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
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
    Brian Henry, Aug 2, 2004
    #4
  5. 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" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:%...
    > > It's a known question. Server-side doesn't know about this sort of
    > > client-side changes.
    > >
    > > Eliyahu
    > >
    > > "Brian Henry" <> wrote in message
    > > news:...
    > > > 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
    > > >
    > > >

    > >
    > >

    >
    >
    Eliyahu Goldin, Aug 2, 2004
    #5
  6. 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
    Steven Cheng[MSFT], Aug 3, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. kent
    Replies:
    1
    Views:
    852
    Andrew de la Harpe
    May 3, 2004
  2. Brian Henry
    Replies:
    1
    Views:
    2,904
    Steven Cheng[MSFT]
    Jul 14, 2004
  3. K B
    Replies:
    2
    Views:
    646
  4. Tomas
    Replies:
    1
    Views:
    556
    Munna
    Aug 12, 2008
  5. Replies:
    0
    Views:
    253
Loading...

Share This Page