【问题标题】:asp.net mvc dropdownlist onchange routingasp.net mvc dropdownlist onchange 路由
【发布时间】:2010-11-01 11:47:51
【问题描述】:

我在将项目转移到 iis 服务器时遇到问题。在 asp.net 开发服务器上,所有路由都很顺利。现在我想迁移到 iis 服务器,而我在 select 标签上的 onchange 属性不起作用。当我尝试从https://www.web.com/Manager/Authorized/Accounts/0 使用

onchange="location.href='<%= Manager.MyConfiguration.Prefix %>/Authorized/Authorized/Accounts/'+this.value"

在明显的页面上,我最终到达https://www.web.com/Manager/Authorized/Accounts/0/Manager/Authorized/Authorized/Accounts/13424

每个 href 属性都有同样的问题,Html.Actionlink 几乎解决了大部分问题,但我仍然不知道如何路由 onchange 或 onclick。

是我的想法,如何在那里添加路由的 /Manager/ 部分(为了不在本地开发服务器上使用它)。如果没有这部分,我只会得到https://www.web.com/Authorized/Accounts/13424,这也是错误的。

【问题讨论】:

  • 我认为您应该发布您的 RouteTable 和 Controller.Action 代码

标签: asp.net-mvc iis routing onchange


【解决方案1】:

?:

<%= Url.Content("~/Authorized/Authorized/Accounts/") %>

【讨论】:

    【解决方案2】:

    我不太确定我是否完全理解这个问题,但您似乎可以使用 VirtualPathUtility 类并执行类似的操作

    '<%=VirtualPathUtiliy.ToAbsolute("~/Authorized/Authorized/Accounts/")%>'
    + this.value
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-03-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多