Hi,
Select Country Value If i can type value equal to abc in asp.net mVC
I have one dropdown with relevant values
Id Country
1 India
2 America
Initally after loading of page it can display all country values later in textbox i am going insert Value 'abc' then select by default
India value in dropdown and disable the dropdown
Could you please help me
@model Sample.Models.Country
<input type="text" id="Id" onchange="GetCountryValue()"/>
<br />
@Html.DropDownListFor(a => a.Country, new SelectList(Model.LstCountry, "ID", "Value", "selected"), "Country*", new { @class = "form-control", @id = "idtxtCountry", @onchange = "FetchTownDetails()" })
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.0/jquery.validate.js"></script>
<script type="text/javascript">
function GetCountryValue() {
var Id = $('Id').text();
$.ajax({
url: "../../Marine/GetCountryValue",
data: "id=" + Id,
type: "POST",
success: function (data) {
}
})
}
</script>