Create.cshtml
Dosyayı İndir
@model AspMvcJQuery.Sample
@{
ViewBag.Title = "Create";
}
<h2>Create</h2>
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
<legend>Sample</legend>
<div class="editor-label">
@Html.LabelFor(model => model.SampleName)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.SampleName)
@Html.ValidationMessageFor(model => model.SampleName)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.SampleValue)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.SampleValue)
@Html.ValidationMessageFor(model => model.SampleValue)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.SampleDate)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.SampleDate)
@Html.ValidationMessageFor(model => model.SampleDate)
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
<script type="text/javascript">
$(function () {
alert("Çağrıldı");
$("#SampleName").autocomplete({
source: function (request, response) {
$.ajax({
url: "/Complete/Suggestions", type: "POST", dataType: "json",
data: { searchText: request.term, maxResults: 10 },
success: function (data) {
response($.map(data, function (item) {
return { label: item.SampleName, value: item.SampleName, id: item.SampleId }
}))
}
})
},
select: function (event, ui) {
alert(ui.item ? ("You picked '" + ui.item.label + "' with an ID of " + ui.item.id)
: "Nothing selected, input was " + this.value);
}
});
});
$(document).ready(function () {
$('#SampleDate').datepicker();
});
</script>
}
Dosyayı İndir