I have a DropDownList with two options: Item 1 and Item 2. I have a textBox where the user for the information based on the item he chose in the DropDownList and the text he typed.
After he makes the first search, the information he is searching for is shown in a div. If the user tries to make another search, I need to make the div to disappear when he changes the option in the DropDownList.
I tried the following code:
In ASP.NET:
<asp:DropDownList ID="SearchOptionsDropDownList" runat="server" onselectedIndexChanged="SearchOptionsDropDownList_SelectedIndexChanged" onchange="java script:hideBottomDiv('<%=BottomDiv.ClientID %>')">
<asp:ListItem Text="Item 1" Value="1" />
<asp:ListItem Text="Item 2" Value="2" />
</asp:DropDownList>
In java script:
function hideBottonDiv(divId) {
document.getElementById(divId).style.display = 'none';
}
In vb script:hideBottomDiv('<%= " & BottomDiv.ClientID & "%>')")
End Sub
However, when I try changing the selected item in the DropDownList this error message is fired: Microsoft JScript runtime error: Object expected. And the following text is highlighted:
<select name="ctl00$mainCopy$SearchOptionsDropDownList" id="ctl00_mainCopy_SearchOptionsDropDownList" onchange="[color=#CC0000]java script:hideBottomDiv('<%=BottomDiv[/color].ClientID %>')">
What is happening here and why my code is not working?
Thanks a lot,
Ana
This post has been edited by annacd: 27 November 2009 - 02:11 PM

New Topic/Question
Reply




MultiQuote




|