2015-11-22 47 views
1

我有3個表格,如下所示。我有3個控制器和視圖。在Payment/Create.cshtml中,我需要在創建任何付款之前添加客戶搜索功能。MVC 5如何將搜索功能添加到Controller/Create?

我需要首先檢查正確的客戶,當我找到它時,我需要添加付款創建表並輸入其他值並創建新的付款。我怎麼做?

enter image description here

enter image description here

回答

1

如果客戶場u需要顯示所有的客戶名字的意思是

在控制器:

 public ActionResult Create() 
    { 
     ViewBag.CUSTId = new SelectList(db.CUSTOMERS, "CUSTId", "CustomerName"); 
     return View(); 
    } 

在View:

 @Html.DropDownList("CUSTId ", String.Empty) 

你需要搜索方法,意思正好看到下面的視頻üIL瞭解如何做到這一點

https://www.youtube.com/watch?v=Slw-gs2vcWo

+0

謝謝Vinoth,我做到了。 – NTMS

相關問題