<script language="
VB" runat="server">
Sub btnsubmit(Src As Object, E As EventArgs)
if countryname.text="USA" then
country.selectedindex=1
end if
End Sub
</script>
<form runat="server">
Please enter country Name:<asp:textbox id="countryname" runat="server"/>
<br>
<br>
You selected the country<asp:dropdownlist id="country" runat="server">
<asp:ListItem>Argentina</asp:ListItem>
<asp:listitem >USA</asp:listitem>
<asp:ListItem>UK</asp:ListItem>
<asp:ListItem>Australia</asp:ListItem>
<asp:ListItem>Cananda</asp:ListItem>
.
.
.
more countries name in dropdown list.
.
.
</asp:dropdownlist>
<asp:button text="submit" id="btn" onclick="btnsubmit" runat="server" />
</form>
PLEASE REMEMBER THERE ARE MORE THAN 50 COUNTRIES.
if the person enters USA in the testbox and clicks the submit button then the USA should come as selected.
the code i've written above works perfectly. but if i had to do it for 50 countries then there would be about 50 if statements.
is there any other methods to do it.
Can i not do it by the value of the string that is entered in the textbox and match the string in the dropdownlist to bring it as selected item.
can you please write the code.
much much thanks if you can help me.