Help with hide
Help with hide
Hello all i have this little issue getting this to work, i have a dropdownlist in asp.net inside a formview and jquery cant find the control im guessing because its inside a form, this is what i got and it works on another page without a formview
i get this error
Name 'Country' is not declared
- <script language="javascript" type="text/javascript">
$(function () {
$('#<%= Country.ClientID %>').change(function (e) {
var selectedText = $('#<%= Country.ClientID %> option:selected').text();
if (selectedText == "--Select--") {
$('#DivState1').hide(400);
$('#DivState2').hide(400);
$('#DivProvidence1').hide(400);
$('#DivProvidence2').hide(400);
}
else
if (selectedText == "United States") {
$('#DivState1').show(400);
$('#DivState2').show(400);
$('#DivProvidence1').hide(400);
$('#DivProvidence2').hide(400);
}
else {
$('#DivState1').hide(400);
$('#DivState2').hide(400);
$('#DivProvidence1').show(400);
$('#DivProvidence2').show(400);
}
return false;
});
});
</script>
<asp:DropDownList ID="Country" runat="server" SelectedValue='<%# Eval("UserCountry") %>'>
<asp:ListItem Value="">--Select--</asp:ListItem>
<asp:ListItem>Uganda</asp:ListItem>
<asp:ListItem>Ukraine</asp:ListItem>
<asp:ListItem>United ArabEmirates</asp:ListItem>
<asp:ListItem>United Kingdom</asp:ListItem>
<asp:ListItem>United States</asp:ListItem>
<asp:ListItem>United States Minor Outlying Islands</asp:ListItem>
<asp:ListItem>Uruguay</asp:ListItem>
<asp:ListItem>Uzbekistan</asp:ListItem>
<asp:ListItem>Vanuatu</asp:ListItem>
<asp:ListItem>Vatican City State(Holy See)</asp:ListItem>
<asp:ListItem>Venezuela</asp:ListItem>
<asp:ListItem>Viet Nam</asp:ListItem>
<asp:ListItem>Virgin Islands (British)</asp:ListItem>
<asp:ListItem>Virgin Islands (U.S.)</asp:ListItem>
<asp:ListItem>Western Sahara</asp:ListItem>
<asp:ListItem>Yeman</asp:ListItem>
<asp:ListItem>Yugoslavia</asp:ListItem>
<asp:ListItem>Zaire</asp:ListItem>
<asp:ListItem>Zambia</asp:ListItem>
<asp:ListItem>Zimbabwe</asp:ListItem>
<asp:ListItem>Other</asp:ListItem>
</asp:DropDownList>
<tr>
<td align="right">
<div id="DivState1" style="display: none">
<span style="color: #FF0000">*</span>State:
</div>
<div id="DivProvidence1" style="display: none">
<span style="color: #FF0000">*</span>Providence:
</div>
</td>
<td>
<div id="DivState2" style="display: none">
<asp:DropDownList ID="State" runat="server" DataSourceID="SqlState"
DataTextField="Name" DataValueField="Name" AppendDataBoundItems="True"
SelectedValue='<%# Eval("UserState") %>'>
<asp:ListItem Value="">--Select--</asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="SqlState" runat="server"
ConnectionString="<%$ ConnectionStrings:MyNetBuddiesConnectionString %>"
SelectCommand="SELECT * FROM [States] ORDER BY [Name]"></asp:SqlDataSource>
</div>
<div id="DivProvidence2" style="display: none">
<asp:TextBox ID="Providence" runat="server" Text='<%# Eval("UserProvidence") %>'></asp:TextBox>
</div>
</td>
</tr>