2017-04-19 11 views
1

を結果自分の行動の結果である:テキストボックスは、アクションから返さここ

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を表示するはずですが、何も表示していません。コードにエラーがありますか?

答えて

1
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); 
} 
関連する問題