C# JQuery根据DDL选择更新文本框

C# JQuery根据DDL选择更新文本框,c#,jquery,post,model-view-controller,get,C#,Jquery,Post,Model View Controller,Get,我在MVC4上有一个序列号生成方法 当我从DDL中选择一个产品ID并按create键时,它会生成一个序列号,这对索引页没有问题 但是,我希望在创建过程中向用户显示序列号,这样一旦用户从DDL中选择值,序列号就会生成并显示在只读框中 下面是我的代码片段,它完成了串行生成器 // // POST: /Item/Create [HttpPost] public ActionResult Create(Item item) { if (ModelStat

我在MVC4上有一个序列号生成方法

当我从DDL中选择一个产品ID并按create键时,它会生成一个序列号,这对索引页没有问题

但是,我希望在创建过程中向用户显示序列号,这样一旦用户从DDL中选择值,序列号就会生成并显示在只读框中

下面是我的代码片段,它完成了串行生成器

//
    // POST: /Item/Create

    [HttpPost]
    public ActionResult Create(Item item)
    {
        if (ModelState.IsValid)
        {
            string SerialNumber = string.Format("SN/{0}/{1}", DateTime.Now.Year, item.ProductID);
            item.SerialNumber = SerialNumber;

            db.Items.Add(item);
            db.SaveChanges();
            return RedirectToAction("Index");
        }

        ViewBag.ProductID = new SelectList(db.Products, "ProductID", "ProductID", item.ProductID);
        return View(item);
    }
我对jquery的经验很少,因此获得关于如何实现这一想法的指导或帮助将是非常好的。如果有比jquery更好的方法,请告诉我:)

我很乐意提供任何信息请求


谢谢

这会给你确切的想法binaryintellect.net/articles/…–@Frebin Francis(归功于Frebin)

这会给你确切的想法