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...
}