views:

567

answers:

2

I have a listBox whose values I am manipulating by javascript for e.g adding a new Item to list. Now when I am trying to access this listBox from Server its only showing me the values that were originally part of ListBox at PageLoad. The newly added items are not accessible.

How can I access those new added Items at server

+2  A: 

You need to use Request.Params["YourListBoxID'] to read the added values.

Henk
A: 

I would look at where you are populating the list and see if you populate it each page load or only if !Page.IsPostBack. If you load the contents of the list on each page load you will wipe out any changes from the client with the original data.

You are going to want to do something like this:

if (!Page.IsPostBack)
{
    // load your list up
}

This means that on subsequent postbacks your list will not be refreshed from your datasource and will not overwrite any client changes.

Andrew Hare