简体   繁体   English

在Url.Action中添加“#”

[英]Add a “#” to an Url.Action

The thing is that I have a card div in a View that when being clicked redirects you to another View; 问题是我在一个视图中有一个div卡片,单击该按钮时会将您重定向到另一个视图; it is working fine and Im getting and URL like : localhost:34195/Home/Details/1 , but I need to add a # symbol on the Id parameter for me to get an URL like localhost:34195/Home/Details/#1 . 它工作正常,并且我正在获取URL,例如: localhost:34195/Home/Details/1 ,但是我需要在Id参数上添加#符号以获取URL,例如localhost:34195/Home/Details/#1

This is the div that calls the other View: 这是调用另一个View的div:

<div class="card z-depth-5" onclick="location.href='@Url.Action("Details", "Home",new { id = item.Id })'">

在用户提供了一些删除答案的帮助之后,我通过更改如下onclick来实现了我所需要的:

<div class="card z-depth-5" onclick="location.href='@Url.Action("Details", "Home")/#@item.Id'">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM