2013-05-20 2 views
1

에 표시되지 않는 이유 결과 값이 눈금 열의 입력에 나타나지 않으므로? 추신 : 테스트 입력에서 괜찮습니다! = ((I는 도움 기능 Produtos_AtualizarProdutoLista (@ item.ProductId)결과 값이 <input valorTotal [@ item.ProductId]

감사를 호출하는 다른 입력이!

// WEBgrid 콜럼 및 TESTE의 INPUT =========

grid.Column(
       format: @<input type="text" id="valorTotal[@item.ProductId]"    style="width:60%" />, 
       header: "ValorTotal" 
      ) 

         ) 


<input type="text" id="teste"/>  

// SCRIPT ===============

function Produtos_AtualizarProdutoLista(productId) { 


     var strAction = '@Url.Action("Produtos_AtualizarProdutoLista","InvoiceInput")'; 
     var quantity = document.getElementById('qtdCompra[' +productId+ ']').value; 
     var buyPrice = document.getElementById('precoCompra[' +productId + ']').value; 

$.get(strAction, { productId: productId, quantity: quantity, buyPrice: buyPrice }, function (dados) { 
      $("#teste").val(dados.ValorTotal); 
      $("#valorTotal["+productId+"]").val(dados.ValorTotal); 
     }); 

// CONTROLLER

[HttpGet] 
    public ActionResult Produtos_AtualizarProdutoLista(int productId, decimal quantity, decimal buyPrice) 
    { 

     string valorTotal = (quantity * buyPrice).ToString(); 

     return Json(new { ValorTotal = valorTotal }, JsonRequestBehavior.AllowGet); 

    } 

답변

0

다음과 같아야합니다. id="valorTotal['@item.ProductId']"?