gpt4 book ai didi

query-string - Asp.net 5 mvc 6 获取查询字符串以查看

转载 作者:行者123 更新时间:2023-12-04 16:21:13 24 4
gpt4 key购买 nike

我已经用谷歌搜索了几个小时。但仍然无法得到答案。我需要在 Razor View 中获取查询字符串参数。

这是我的代码:

              if @(Request.Query["value"]=="P"){

<a href="@Url.Action("Index", "Staff",new { status = "A"})"><strong>Active (@ViewData["activeCount"]) </strong></a> &nbsp;
<a href="@Url.Action("Index", "Staff",new { status = "I" })">In-Active (@ViewData["inActiveCount"])</a>&nbsp;
<a href="@Url.Action("Index", "Staff",new { status = "D" })">Delete (@ViewData["deleteCount"])</a>&nbsp;
}else{
<a href="@Url.Action("Index", "Staff",new { status = "A"})">Active (@ViewData["activeCount"])</a> &nbsp;
<a href="@Url.Action("Index", "Staff",new { status = "I" })"><strong>In-Active (@ViewData["inActiveCount"])<strong></a>&nbsp;
<a href="@Url.Action("Index", "Staff",new { status = "D" })">Delete (@ViewData["deleteCount"])</a>&nbsp;

}

但我收到错误“ 当前上下文中不存在名称‘请求’

截图
enter image description here
有人有解决方案吗?谢谢

最佳答案

使用 Context.Request.Query["value"]而不是 Request.Query["value"]

关于query-string - Asp.net 5 mvc 6 获取查询字符串以查看,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35056698/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com