Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > listbox changes on the client side aren't reflected on the server side

Reply
Thread Tools

listbox changes on the client side aren't reflected on the server side

 
 
Joe Abou Jaoude
Guest
Posts: n/a
 
      11-18-2004

hi all,

I have 2 listboxes in my web page. one listbox has 5 items when the page
is loaded, the other one is empty. The user then add fields from the
filled listbox to the empty listbox. this is done successfully using
javascript.
when the page is submitted i want to check the items that the user added
to the listbox.
however i always get that the first listbox has 5 items and the second
listbox is empty. It's like the user changes wasn't submitted to the
server.
the 2 listboxes has the EnableViewState = true.

the javascript that i use to add items to the listbox is the following:
(i use the listbox.remove method and the new option () )

function AddItem() {
if(window.document.Form1.lstAll.selectedIndex == -1) return;
var item =
window.document.Form1.lstAll.options[window.document.Form1.lstAll.select
edIndex].text;
var i = Form1.lstSort.length;
Form1.lstSort.options[i] = new Option(item, i);
window.document.Form1.lstAll.remove(window.documen t.Form1.lstAll.selecte
dIndex);
}

thanx

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
 
Thiruppathi S
Guest
Posts: n/a
 
      11-18-2004
Hi Joe,

Use hidden control to store the state of the listboxes

Rgds,
Thiruppathi S
"Joe Abou Jaoude" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> hi all,
>
> I have 2 listboxes in my web page. one listbox has 5 items when the page
> is loaded, the other one is empty. The user then add fields from the
> filled listbox to the empty listbox. this is done successfully using
> javascript.
> when the page is submitted i want to check the items that the user added
> to the listbox.
> however i always get that the first listbox has 5 items and the second
> listbox is empty. It's like the user changes wasn't submitted to the
> server.
> the 2 listboxes has the EnableViewState = true.
>
> the javascript that i use to add items to the listbox is the following:
> (i use the listbox.remove method and the new option () )
>
> function AddItem() {
> if(window.document.Form1.lstAll.selectedIndex == -1) return;
> var item =
> window.document.Form1.lstAll.options[window.document.Form1.lstAll.select
> edIndex].text;
> var i = Form1.lstSort.length;
> Form1.lstSort.options[i] = new Option(item, i);
> window.document.Form1.lstAll.remove(window.documen t.Form1.lstAll.selecte
> dIndex);
> }
>
> thanx
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
 
 
 
Joe Abou Jaoude
Guest
Posts: n/a
 
      11-18-2004


yea, this is a work around to resolve the problem. but shouldn't the
listbox control itself save its state ?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Changes in aspx page not reflected on production site Patrice ASP .Net 0 04-12-2010 08:45 AM
ASP.NET Listbox Client Side changes not reflected on page chandru ASP .Net 1 07-20-2007 03:32 PM
Client side changes not reflected in page =?Utf-8?B?cGF0cmlja2RyZA==?= ASP .Net 24 03-28-2007 02:04 AM
urgent-changes getting reflected in other folder also monika ASP .Net 2 04-25-2005 04:41 AM
client side scripting changes to be reflected back to server Sumit ASP .Net 1 10-16-2003 04:17 PM



Advertisments