【问题标题】:Passing values from View to Action Method using href = Url.Action()使用 href = Url.Action() 将值从 View 传递到 Action 方法
【发布时间】:2017-10-10 10:36:20
【问题描述】:

我正在尝试将这些值传递给Confirmation 操作结果,但我有

语法错误 :missing ;

 var url = '@Url.Action("Confirmation", "BookReservation")/?record_locator=' + record_locator +'&hid='@Request.QueryString["hid"] ;

    window.location.href = url;

他们对这段代码有什么问题吗

任何建议

【问题讨论】:

  • 你的单引号不合适
  • var url = '@Url.Action("Confirmation", "BookReservation")' +'?record_locator=' + record_locator +'&hid=' + @Request.QueryString["hid"];

标签: c# jquery asp.net asp.net-mvc razor


【解决方案1】:

首先创建网址

var url = @Url.Action("Confirmation", "BookReservation");

然后你添加参数

window.location.href = url + '?record_locator=' + record_locator + '&hid=' + @Request.QueryString["hid"] ;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-12-25
    • 1970-01-01
    • 1970-01-01
    • 2012-08-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多