I am using following code to generate image with link to controller action:
<a href="@Url.Action("ViewProduct", "ShopWindow", new {id=prod._id,title = prod.ProductTitle})">
<img class="group list-group-image" src="@Url.Content(prod.ImagePath)?w=150&h=150" alt="" />
</a>
The above code generates the links like :
http://localhost:53298/ShopWindow/ViewProduct/58cbd66ad2b0c91b00b1eb94/CK1Red
is there a way to create link with parameters name like:
http://localhost:53298/ShopWindow/ViewProduct?id=58cbd66ad2b0c91b00b1eb94&title=CK1Red
Thanks
如果您在RouteConfig
定义MVC Route /{controller}/{action}/id/title
,则它将id, title
作为查询字符串参数自动附加到生成的URL。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.