1

因为结果值没有出现在网格列的输入中?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);

    }

使用位时最好使用位运算符:

number = 19

num_bits = 8
bits = [(number >> bit) & 1 for bit in range(num_bits - 1, -1, -1)]

这为您提供了 8 个数字的列表:[0, 0, 0, 1, 0, 0, 1, 1]。遍历它并打印任何需要的内容:

for position, bit in enumerate(bits):
    print '%d  %5r (%d)' % (position, bool(bit), bit)
4

1 回答 1

0

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

于 2013-07-29T16:46:46.890 回答