[VB2005]-Web-asp:ListBox
- From: Gilbert <gilbert@xxxxxxxxxxxxx>
- Date: Wed, 26 Apr 2006 04:00:01 -0700
Hello. How can I test on the client side that an element has been selected in
a asp:ListBox, and inhibit the sending to the server if not? I have tried:
<script language="javascript" type="text/javascript">
function Validation() {
alert(document.YFRLDD0011.lstSite.SelectedIndex);
if (document.YFRLDD0011.lstSite.SelectedIndex = -1) {
alert("Veuillez choisir un site.");
return false;
}
return true;
}
</script>
....
<form id="YFRLDD0011" runat="server" onsubmit="Validation()">
<asp:ListBox ID="lstSite" runat="server" DataSourceID="ds"
DataTextField="SyNomPaysSite"
DataValueField="AnnNumSite" Rows="30"></asp:ListBox>
but alert(document.YFRLDD0011.lstSite.SelectedIndex) always returns
"Undefined".
--
Thank you. Gilbert.
.
- Prev by Date: Re: Problem clearing a collection so it can be rebuilt
- Next by Date: Re: Image Thumbnails
- Previous by thread: Re: Problem clearing a collection so it can be rebuilt
- Next by thread: Listview imagelist problem
- Index(es):
Relevant Pages
|