Problems with ListBox Control

N

Nayak

On my web page, I want to let the user change the order of items in the
LISTBOX.
I could do that using the javascript , but when the page is submitted the
listbox is reset to its original values.
what happenig here ?

I am using ASP.Net with C# as the code behind
 
B

Brock Allen

The items in the DropDownList are stored in ViewState, so modifying the actual
DDL in the HTML DOM doesn't affect the ViewState, and thus when posted back
to the server isn't reflected in the server-side DDL. You'll need to build
some other scheme to submit that info to the server. Typically a hidden input
that you manipulate from the same javascript that reorders the DDL. Then
on the server you'll have to reorder the DDL based upon that hidden.
 

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,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top