ボタン: @supplierQuoteId は、Razor を介してモデルから取得されます。
<a id="@supplierQuoteId" class="t-button" style="float: right; margin: 3px; padding: 2px; line-height: 0;"
onclick="ajaxEditSupplierQuote(this.id)">
<span class="t-icon t-edit">Edit</span>
</a>
JavaScript: $.ajax が完了したら、Telerik ウィンドウを開くと、id="supplierquote-dialog-contet" を持つ .Content - div があり、コントローラーから返された PartialView で埋められます。 html(" ") . 空の。
<script type="text/javascript">
function ajaxEditSupplierQuote(id) {
var strUrl = "/SupplierQuote/Edit" + "/" + id.toString();
$.ajax({
type: "GET",
url: strUrl,
dataType: "html",
success: function (data) {
if (!data) {
$('#supplierquote-dialog-content').html(" "); // error check
}
else {
$('#supplierquote-dialog-content').html(data);
}
},
complete: function () {
var window = $("#SupplierQuoteDialog").data("tWindow");
window.center().open();
}
});
}
</script>
サプライヤー見積コントローラー:
[HttpGet]
public ActionResult Edit(Guid id)
{
SupplierQuoteEntity supplierQuote = _supplierQuoteRepository.GetById(id);
return PartialView("Edit", supplierQuote);
}