View Single Post
  #1 (permalink)  
Old June 6th, 2007, 12:29 PM
sarah lee sarah lee is offline
Friend of Wrox
Join Date: Aug 2006
Location: norcross, Ga, USA.
Posts: 107
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to avoid page refreshing

hi all

I am trying to solve this problem for a while. but not yet done

I dont know javasxript, but i have to use that in my application for the below task

I have 3 listboxes in my page, and have them loaded with data

I have 3 checkboxes also under each listbox

What i want to do is, when checkbox1 is checked, listbox1 items all get selected

When checkbox is unchecked, the items get deselected.

Also i am trying so that, while the checkbox is checked and the items are selected, if the

user selects a particular item in listbox, the checkbox check should get removed.

The same thing i want to accomplish for the 3 listboxes

All these i have done in code behind, which causes page refreshingI am trying to do them in javascript

I hve tried the below code, but its not getting any result, the listbox items are not being selected
function selectChange(checkBox1)

var listBox = document.getElementById('lstAccounts');

for (var i=0; i<listBox.options.length; i++)
listBox.options[i].selected = true;
for (var i=0; i<listBox.options.length; i++)
listBox.options[i].selected = false;

<asp:ListBox ID="lstAccounts" runat="server" Height="125px" Width="135px" SelectionMode="Multiple" AutoPostBack="True"></asp:ListBox> <input id="Checkbox1" type="checkbox" onclick="selectChange(this)" />Check All
Hope someone can help me in this

Reply With Quote