【问题标题】:Why doesn't the result value appear in <input valorTotal[@item.ProductId]为什么结果值没有出现在 <input valorTotal[@item.ProductId]
【发布时间】:2013-05-15 15:11:49
【问题描述】:

因为结果值没有出现在网格列的输入中? PS:在测试输入是没问题的! =((我有另一个输入调用函数 Produtos_AtualizarProdutoLista(@item.ProductId)

谢谢你的帮助!!!

// WEBgrid 列和测试输入=========

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

                        )


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

//脚本===============

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);
        });

//控制器

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

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

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

    }

【问题讨论】:

    标签: c# asp.net-mvc asp.net-mvc-3 webgrid


    【解决方案1】:

    不应该是: id="valorTotal['@item.ProductId']"?

    【讨论】:

      猜你喜欢
      • 2017-05-28
      • 2020-07-09
      • 2023-04-04
      • 1970-01-01
      • 1970-01-01
      • 2020-07-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多