小编use*_*788的帖子

Url.Action参数?

在列出控制器我有,

 public ActionResult GetByList(string name, string contact)
 {        
     var NameCollection = Service.GetByName(name);    
     var ContactCollection = Service.GetByContact(contact);           
     return View(new ListViewModel(NameCollection ,ContactCollection));
 }
Run Code Online (Sandbox Code Playgroud)

在ASPX页面我打电话,

 <a href="<%:Url.Action("GetByList","Listing" , new {name= "John"} , new {contact="calgary, vancouver"})%>"><span>People</span></a>
Run Code Online (Sandbox Code Playgroud)

我在ASPX代码中遇到问题...我可以提取名称为john的记录.但当我给联系人="卡尔加里,温哥华"时,网页会出错.

如何在Url.Action中调用两个参数.我尝试了以下但这似乎也错了.

  <a href="<%:Url.Action("GetByList","Listing" , new {name= "John" , contact= " calgary, vancouver" })%>"><span>People</span></a>
Run Code Online (Sandbox Code Playgroud)

html asp.net url.action asp.net-mvc-2

111
推荐指数
2
解决办法
31万
查看次数

标签 统计

asp.net ×1

asp.net-mvc-2 ×1

html ×1

url.action ×1