473,320 Members | 2,035 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Problem with listbox at client side

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,listBoxAs signedFieldEngineers)
{
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,listBoxAs signedFieldEngineers);");

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

Apr 18 '06 #1
2 1384
when the browser post the page, it only sends the selecteditem value for a
listbox back to the server. therefore the server has no way of knowing the
changes made in the list. you should add a hidden field that the client
script updates with the current contents of the lists, then the serverside
code can process this hidden field to update the lists on the serverside.

-- bruce (sqlwork.com)
"Anup" <an*********@gmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
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,listBoxAs signedFieldEngineers)
{
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,listBoxAs signedFieldEngineers);");

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

Apr 18 '06 #2
Hi Bruce,

Thank you for valuable reply,
Can you please guide me how do I use a hidden field, particularly in
this case, as I am novice to C# and ASP.NET.

Thanks,

Anup

Apr 19 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Kathryn | last post by:
Hiya I have a problem with using some client side and server side scripting together in an ASP. I'm using VBScript. What I'm trying to achieve is this - - Page loads up and some server side...
6
by: Valerian John | last post by:
I have a ListBox webcontrol on an aspx page. Items are added to the ListBox using client-side code. However, when the page is posted back the items are missing/not available. (It is like the...
5
by: Eddie Clark | last post by:
I'm trying to access the items in a listbox from a client-side vb script. <asp:listbox id="ListBox1" style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 120px" runat="server" Width="400px"...
2
by: Simon Prince | last post by:
Help I have a ASP:Listbox on a form. My page Adds items to this this via Client-Side Script only. Such as... var vObj_TargetElement =...
3
by: Stimp | last post by:
I have a listbox of values that I populate from a database. I want the user to be able to re-order the list (by first selecting an item and then clicking 'up' or 'down' buttons) and then save...
10
by: Mr Newbie | last post by:
DropDown lists and Listboxes do not appear in the list of controls and values passed back to the server on PostBack in Request.Form object. Can someone confirm this to be correct and possibly...
5
by: Anup | last post by:
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,...
3
by: Brian Simmons | last post by:
Hi All, I search on codeproject and google but didn't find what I was looking for. Anybody know of a good implementation where you have 2 listboxes and you want to move items between the 2. ...
4
by: bogdan | last post by:
Hi, I have two listboxes on a page and need to move items between them - using buttons (e.g. "<<" ">>"). Can this be done on a client side in asp.net? I'd like to avoid hitting the server on...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.