Url.Action parameters?

前端 未结 4 1107
野性不改
野性不改 2020-11-28 04:42

In listing controller I have,

 public ActionResult GetByList(string name, string contact)
 {        
     var NameCollection = Service.GetByName(name);    
          


        
4条回答
  •  庸人自扰
    2020-11-28 05:31

    The following is the correct overload (in your example you are missing a closing } to the routeValues anonymous object so your code will throw an exception):

    ">
        People
    
    

    Assuming you are using the default routes this should generate the following markup:

    
        People
    
    

    which will successfully invoke the GetByList controller action passing the two parameters:

    public ActionResult GetByList(string name, string contact) 
    {
        ...
    }
    

提交回复
热议问题