weixin_33713503 2010-07-23 07:29 采纳率: 0%
浏览 13

<%%>之间的JavaScript参数

I have a 'demo' controller with 'demo' action that gets a parameter, and I want to give them in JavaScript.

aspx:

<script type="text/javascript">
function openDefault(miez) {
       var manager1 = $find("<%= RadWindowManager2.ClientID %>");
       var str = "/demo/demo/" + miez;
       manager1.open(str3, "RadWindow2");
}  
</script>

It works if I give them one parameter, but for example miez="par1 par2", it doesn't works. (of course, because /demo/demo/park1 par2 address doesn't exists).

So I tried another way:

aspx:

<script type="text/javascript">
function openDefault(miez) {
       var manager1 = $find("<%= RadWindowManager2.ClientID %>");
       manager1.open('<% Url.Action("demo", "demo") %>', "RadWindow2");
}  
</script>

This works without parameters. The problem is that I don't know how can I give parameter using this form, if the parameter is a JavaScript variable.

manager1.open('<% Url.Action("demo", "demo",new{id="par1"}) %>', "RadWindow2");

How can I get 'par1' to replace the value of 'miez'?

  • 写回答

2条回答 默认 最新

  • weixin_33737774 2010-07-23 07:37
    关注

    If you need the output of the Url.Action("demo", "demo") server side code, you should place it in a <%=%> section:

    manager1.open('<%= Url.Action("demo", "demo",new{id="par1"}) %>', "RadWindow2");
    
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?