0
我有一個視圖模型,其中綁定下面筆者認爲頁:視圖模型綁定問題
var form = $("form");
$(function() {
var viewModel = kendo.observable(JSON.parse('@Html.Raw(Json.Encode(Model))'));
kendo.bind(form, viewModel[0]);
});
但這裏的問題是,我使用視圖模型[0]這看起來很奇怪我。
我們可以重寫綁定代碼如下喜歡不[0],這會給問題,同時結合
kendo.bind(form, viewModel);
這是我的看法:
@model IList<PC.CManager.Cs.Domain.Models.Ln>
@using (Html.BeginForm())
{
<div class="panel panel-primary">
<div class="panel-heading inform" style="">
<table clases="panel-title inform">
<tr>
<td class="inform">Loan Number: <label id="loannum" name="loannum">1000100001</label></td>
<td class="inform">Status: <label id="loanstatus" name="loanstatus">Forclosure</label></td>
<td class="inform">Loan Type: <label id="loantype" name="loantype">Government(FHA)</label></td>
</tr>
</table>
</div>
控制器:
public async Task<ActionResult> ClaimDetail()
{
//return View();
string id = "1000000246";
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
var LnDetail = await _LnProxy.GetLnDetailByLnNum((string)id);
if (LnDetail == null)
{
return HttpNotFound();
}
return View(LnDetail);
}
我們如何重寫綁定代碼,看起來不錯,工作正常?