For Programmers: Free Programming Magazines  


Home > Archive > C# > April 2006 > Problem with listbox at client side









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Problem with listbox at client side
Anup

2006-04-18, 4:02 am

Hi Group,

In my application there is a very common functionality, where two list
box and present and items are moved between them on button clicks when
selected,

This I am doing client side,
Client side code is like this ->

function
assignInspector(listboxAllFieldEngineers
,listBoxAssignedFieldEngineers)
{
i=0;
while(i<listboxAllFieldEngineers.length)
{
if(listboxAllFieldEngineers.options[i].selected)
{
var optn = document.createElement("OPTION");
optn.text = listboxAllFieldEngineers.options[i].value;
optn.value = listboxAllFieldEngineers.options[i].value;
listBoxAssignedFieldEngineers.options.add(optn);
listboxAllFieldEngineers.remove(i);
continue;
}
i++;
}
return false;
}


Here two list boxes are passed from .CS file ->

buttonAddSelected.Attributes.Add("onclick","return
assignInspector(listboxAllFieldEngineers
,listBoxAssignedFieldEngineers);");



PROBELM:-

Items move from one listbox to other perfectly but when listboxes are
accessed through .cs file, they show there previous state,

e.g. ->

say LeftListBox is having 4 items and RightListBox is having 2
elements,
now I select and move two items from left and move them ro right and
one of previously present items from right to left on button click,

the client side operation is carried out perfectly,

But when I try to use the Items in RightListBox in .CS
file,RightListBox.Items.Count returns only '2' instead of '3', which
are previously present in the RightListBox.


Please tell me where I am going wrong(Using ASP.NET 1.x).


Thanks and Regards,

Anup Daware

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com