ASP.NET ListBox client side event

actually what i want to do is that i have two list boxes. when i click any one one a particular item, the other listbox’s same idex item should get highlighted too… producing a list of listview effect ie. whenever an item is clicked on either of the listboxes, the sames index item on the other listbox will get highlighted too…
to test this i made the below code to see how to integrate javascript in asp.NET

i made a list box and added a javascript function to it
i made the listbox
<asp:listbox id=“lstFilter” Runat=“server”></asp:listbox>
i added a javascript event to it on PageLoad
lstFilter.Attributes.Add(“onchange”, “SelectPair(window.document.form1.lstFilter.options[selectedIndex].text);”)
then i wrote the javascript function :
<script language=“javascript”>
function SelectPair(window.document.form1.lstFilter.options[selectedIndex].text)
{
//lstvalue.select(
window.document.Form1.lstFilter.options[selectedIndex].text = “hahahah”
}
</script>
but nothing is working…can u pls help…
tks a lot…

Can’t help with the asp.net part - try here - the other part is simple enough:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>untitled</title>
<script type="text/javascript">

function setOther(this_select, other_select)
{
	var oSelected_option = this_select.options[this_select.selectedIndex];
	if (oSelected_option.value == '')
		other_select.selectedIndex = 0;
	else
	{
		var opt, i = 0, match_text = oSelected_option.text;
		while (opt = other_select.options[i++])
			opt.selected = (opt.text == match_text);
	}
}

</script>
</head>
<body>
<form>
<select name="test1" size="1" onchange="return setOther(this,test2)">
<option value="">- choose -</option>
<option value="value1">hoohah</option>
<option value="value2">foofah</option>
<option value="value3">wahoo</option>
<option value="value4">yahoo</option>
<option value="value5">ohboy</option>
<option value="value6">blabla</option>
</select>
<select name="test2" size="1" onchange="return setOther(this,test1)">
<option value="">- choose -</option>
<option value="value7">ohboy</option>
<option value="value8">foofah</option>
<option value="value9">blabla</option>
<option value="value10">wahoo</option>
<option value="value11">hoohah</option>
<option value="value12">yahoo</option>
</select>
</form>
</body>
</html>

you are using OPTION…
i want to use <asp:ListBox…
:goof:

you are using OPTION…
i want to use <asp:ListBox…
…and this is a client-side (JavaScript/JScript) forum…