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,但它不显示任何内容。是否在代码中有任何错误?