I am writing an application in asp.NET, I use the MVC 3 model(views engine Razor). I have no idea how to do that after searching for a suitable name in jQuery autocomplete and pressing Enter on the name, application will check appropiate RadioButton.
<script type="text/javascript">
$(function () {
$("#tags").autocomplete({
source: "/Home/TakeGry",
minLength: 1,
select: function (event, ui) {
// I suspect that something needs to add here
}
});
});
</script>
<table>
<tr>
<th>
<div class="demo">
<div class="ui-widget">
<label for="tags">Surowce: </label>
<input id="tags" />
<input id="hiddenElementID" type="hidden" />
</div>
</div>
</th>
<th>
</th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Nazwa)
</td>
<td>
// One of these RadioButton's should be checked, when I hit enter
@Html.RadioButtonFor(modelItem => item.GraID, new { id = item.GraID })
</td>
</tr>
}
After several hours of searching, I found the answer, which I put below:
I must change my script to:
And in foreach ( which print names and RadioButtons ) i must change that:
To:
Thanks for any help :).