如何在mvc中添加动态控件(文本框和下拉列表)并从下拉列表中删除所选项

时间:2014-07-28 07:42:47

标签: c# jquery asp.net-mvc-4

在我的要求中我有两个控件文本框和下拉列表,需要动态创建控件并根据按钮单击使用MVC删除控件动态

enter image description here

用户选择项目后,

项目是下拉列表,而下拉列表中不应向用户显示所选项目

  example :items:  1 bottle
                   2 bottles
                    3 bottles

如果用户选择不应出现在下拉列表中的“1瓶”项目。

enter code here  public ActionResult Index()
    {
        var initialData = new[] {
            new Gift { Name = "Tall Hat", Price = 39.95 },
            new Gift { Name = "Long Cloak", Price = 120.00 },
        };
        return View(initialData);
    }

    [HttpPost]
    public ActionResult Index(IEnumerable<Gift> gifts)
    {
        return View("Completed", gifts);
    }

    public ActionResult Add()
    {
        return PartialView("GiftEditorRow", new Gift());
    }

当我点击按钮时,两个控件正在不同的视图(页面)中添加,我想在同一页面下面添加我

0 个答案:

没有答案