Jquery 我应该用哪个来表达我的观点?

Jquery 我应该用哪个来表达我的观点?,jquery,asp.net-mvc-3,Jquery,Asp.net Mvc 3,我有一个看法: <table id="cartbox"> <thead> <tr> <th>Tên hàng</th> <th>Số lượng</th> <th>Đơn giá</th>

我有一个看法:

 <table id="cartbox">
            <thead>
                <tr>
                    <th>Tên hàng</th>
                    <th>Số lượng</th>
                    <th>Đơn giá</th>
                    <th colspan="2" style="width:70px">Thành tiền</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var line in Model.Cart.Lines)
                {
                    <tr>

                        <td>@line.Product.Name
                        </td>
                        <td class="qty">@Html.DropDownList("Quantity", new SelectList(ViewBag.Items as System.Collections.IList, "Value", "Text", line.Quantity))</td>
                        <td style="color:#3A9504;margin-left:3px" class="price">@string.Format("{0:00,0 VNĐ}", line.Product.Price)</td>
                        <td class="subtotal">@string.Format("{0:00,0 VNĐ}", (line.Quantity * line.Product.Price))</td>
                        <td align="center" style="width:10px"><a href="@Url.Action("RemoveFromCart","Cart",new{ProID= line.Product.ProductID, returnUrl= Request.Url.PathAndQuery})"><img src="@Url.Content("~/Content/Images/delete.png")" style="padding-right:10px" /></a></td>
                    </tr>
                }

            </tbody>
            <tfoot>
                <tr style="border-top-style:solid;border-top-color:#DFDFDF;border-top-width:1px;">
                    <td colspan="3" align="right" style="border-right-color:#808080;border-right-style:solid;border-right-width:1px;text-align:right"><b>Tổng tiền:</b></td>
                    <td style="text-align: center"><b>@string.Format("{0:00,0 VNĐ}", Model.Cart.ComputeTotalValue())</b></td>
                    <td></td>
                </tr>
            </tfoot>
        </table>
}

这个函数的问题是在我刷新页面后,页面返回到原始值,没有任何更改。 或

这个问题是它返回一个新的视图,但是dropdownlist在视图中是重复的


任何人都可以告诉我如何控制或使用哪种方法?请。

如果要在客户端保存信息,您有以下选项:

  • 将其发送到服务器并存储在会话中,然后在查看渲染时使用此信息
  • 在客户端使用本地存储,重新加载后检查本地存储是否有此数据并正确使用
  • function CalValue() {
    $("#select").change(function () {
        var quantity = $(this).val();
        var fprice = $(this).closest("tr").find("td[class^=price]").html();
        var price = fprice.replace(/[,\s(VNĐ)]/g, '')
        var fsubtotal = parseInt(quantity) * parseInt(price);
        var subtotal = 
        $(this).closest("tr").find("td[class^=subtotal]").html(subtotal);
    });
    
       function UpdateValue() {
        $(document.body).on("change", ".Quantity", function () {
            var ProID = $(this).attr("data");
            var Quatity = $(this).val();
            $.ajax({
                type: "GET", url: "/Cart/UpdateValue",
                data: { ProID: ProID, quantity: Quatity },
                success: function (data) {
                    $("#cartbox").html(data);
                }
            }
                );
            $.ajaxSetup({
                cache: false
            });
        });
    }