【发布时间】:2016-01-29 11:06:15
【问题描述】:
我有一个名为PrintPatientConsent.aspx 的视图名称。我需要为两种类型调用它。
但是,默认情况下只调用默认操作方法。即使我传递了参数。
供您参考:
[AcceptVerbs("GET")]
public ActionResult PrintPatientConsent()
{
----
}
[AcceptVerbs("GET")]
[ActionName("PrintPatientConsent")] // i tried to pass action name
public ActionResult PrintPatientConsent(int id)
{
------
}
Javascript:-
前代码:
url = '/Emr/Patients/PrintPatientConsent?Id=' + idd; //where i'm calling Parameterized actionmethod
TopUp.display(url)
谁能帮我找出解决方案..,谢谢。
【问题讨论】:
-
你只需要一个方法——
public ActionResult PrintPatientConsent(int? id)(你可以使用if(id.HasValue)检查一个值是否被传递 -
删除actionname并尝试
-
@UbiquitousDevelopers- 我尝试删除动作名称..,即使它只调用默认动作方法..
-
您是否尝试输入您的网址字符串,而不是
Id,而是id? -
你也可以试试这样的:stackoverflow.com/questions/17457710/…
标签: javascript c# jquery asp.net-mvc model-view-controller