Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/395.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/332.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ActionLink-传递javascript参数_Javascript_C#_Asp.net_Asp.net Mvc 4 - Fatal编程技术网

ActionLink-传递javascript参数

ActionLink-传递javascript参数,javascript,c#,asp.net,asp.net-mvc-4,Javascript,C#,Asp.net,Asp.net Mvc 4,我使用以下方式调用控制器: @Ajax.ActionLink("Clientes", "ContasClientesPartialView", new { codigoEntidade = -1, numeroFiscal = -1, pais = 1,

我使用以下方式调用控制器:

@Ajax.ActionLink("Clientes", "ContasClientesPartialView",
                      new {
                          codigoEntidade = -1,
                          numeroFiscal = -1,
                          pais = 1,
                          distrito = 1,
                          concelho = -1
                      },
                      new AjaxOptions {
                          InsertionMode = InsertionMode.Replace,
                          UpdateTargetId = "TomadoresPesquisaID",
                          HttpMethod = "GET",
                          OnBegin = "onBegin",
                          OnComplete = "onComplete"
                      },
                      new
                      {
                          @class = "btn btn-default",
                          @onclick = "$('#EntidadesPesquisaModal').modal('hide'); $('#TomadoresPesquisaModal').modal('show')",
                          @style = "width:100%;", 
                          @id="pesquisaTomadoresButton"
                      })

但是我需要传递一个javascript参数,有人有解决方案吗?

如果您不想使用
@Ajax.Actionlink可以使用JQuery以这种方式执行:

按钮:

<button class="btn blue" id="btnEditAddressConfirm">
    Save
</button>
控制器对此的操作是:

public string EditEmployeeAddress(
    int employeeId,
    string newAddressLine1,
    string newAddressLine2,
    string newAddressTown,
    string newAddressCounty,
    string newAddressPostcode)
{
    //do whatever you need to in here...
}

你问的问题不是很清楚。javascript参数是什么?您希望将其传递到哪里?
public string EditEmployeeAddress(
    int employeeId,
    string newAddressLine1,
    string newAddressLine2,
    string newAddressTown,
    string newAddressCounty,
    string newAddressPostcode)
{
    //do whatever you need to in here...
}