1
這是我行動的結果:文本框不顯示JSON數據結果
public ActionResult getchqStartNum()
{
tblChqIssue tblci = new tblChqIssue();
DataTable dt = objemp.ChqIssueBs.showChqStartNo();
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
decimal a = Convert.ToDecimal(dt.Rows[i][5].ToString());
decimal b = a + 1;
tblci.chqStartNo = b;
}
}
else
{
tblci.chqStartNo = 1;
}
return Json(tblci.chqStartNo, JsonRequestBehavior.AllowGet);
}
以下是我的角度代碼:
$scope.GetChqStartNo = function() {
crudServiceUser.getChqStartNo().then(function (result) {
$scope.Chqs = result; })
}
crudUserObj.getChqStartNo = function() {
var Emp;
Emp = $http({
method: 'Post',
url: '/Employee/ChequeIssue/getchqStartNum'
}
).then(function (response) {
return response.data;
});
return Emp;
}
return crudUserObj;
});
而下面是我的看法:
<div class="col-md-10">
@Html.TextBoxFor(model => model.chqStartNo, new { type = "text", ng_model = "Chqs.chqStartNo" }){{Chqs.chqStartNo}}
@Html.ValidationMessageFor(model => model.chqStartNo, "", new { @class = "text-danger" })
</div>
文本框chqStartNo未顯示數據,即從操作結果返回1:
else
{
tblci.chqStartNo = 1;
}
return Json(tblci.chqStartNo, JsonRequestBehavior.AllowGet);
該文本框應該顯示1,但它不顯示任何內容。是否在代碼中有任何錯誤?