function ShowCustomerSearch() {
var url = "/Employee/SearchCustomer"; // I want to pass the value of DepotNo into the action Searchcustomer
$("#CustomerSearchDiv").load(url, function () {
$("#CustomerSearchModal").modal("show");
})
}
In Controller
public IActionResult SearchCustomer(string Depotno) // Receive the value of depot number from html
{
CustomerModel Customer = new CustomerModel();
ViewBag.Customers = EmployeeService.GetCameoCustomerMTS(connectionSettings);
return PartialView("CustomerSearch");
}
var url = "/Employee/SearchCustomer?Depotno=" + $("#DepotNo").val();
Look at the HTML of your rendered page to verify the actual id the DepotNo textbox is assigned and change #DepotNo as necessary.
Mark all posts that give the desired result the answer. If you only mark the last that gave you clarification because you misread an earlier post others will be confused. Some of us are here to help others and our point to post ratio matters.
You could add values to the url that need to be passed to the background. Your “Depotno” is going to get the selected items in the select tag, so you could write like this:
var depotno = $("#dropdownDepot option:selected").val();
var url = "/Employee/SearchCustomer?Depotno=" + depotno;
Member
411 Points
1327 Posts
How can send the value from html textbox into controller action
Sep 10, 2019 03:51 PM|polachan|LINK
I want to send the value of Depot Number into the controller action SearchCustomer
My code is given below
In Javascript
In Controller
Please help
Contributor
7048 Points
2189 Posts
Re: How can send the value from html textbox into controller action
Sep 10, 2019 07:31 PM|ryanbesko|LINK
Look at the HTML of your rendered page to verify the actual id the DepotNo textbox is assigned and change #DepotNo as necessary.
Member
180 Points
88 Posts
Re: How can send the value from html textbox into controller action
Sep 11, 2019 04:21 AM|Lewis Lu|LINK
Hi polachan,
You could add values to the url that need to be passed to the background. Your “Depotno” is going to get the selected items in the select tag, so you could write like this:
Best Regards ,
Lewis Lu