【发布时间】:2020-10-03 14:46:39
【问题描述】:
不知怎的,我觉得这很难描述,但我开始了:
我的 SelectClasses Razor 视图页面中有一个 id="id152" 的 div。 为了让我在重新加载时在页面上显示该 div,我必须将后缀 #id152 添加到我的页面 url。
<div id="id152">blabla</div>
...
..
<a href="#id152">Section 7</a>
现在我的问题是:有没有办法将此后缀添加/传递给“RedirectToAction()”?
public ActionResult Index()
{
//All we want to do is redirect to the class selection page and add a suffix
return RedirectToAction("SelectClasses", "Registration", new { id = 99 })); //add suffix here somewhere
}
所以当我的 SelectClasses 视图显示时,url 看起来像这样:
'[url]/SelectClasses/99#id152'
【问题讨论】:
-
什么动作使页面重新加载?如果您没有提交任何表单,则页面无需重新加载页面。
标签: html asp.net-mvc redirecttoaction