【发布时间】:2017-09-12 10:35:32
【问题描述】:
如何将查询字符串值传递给在 ASP.net MVC 应用程序中具有默认值的视图模型参数?
我试过了,但没有成功;
public ActionResult Index(MyAnotherVM filter){
// filter.p doesn't set passed value and it equals to 1
}
public class MyAnotherVM {
public int p { get { return 1; } set { } }
// or
public int p=1;
}
【问题讨论】:
-
我找到了关于使用构造函数的答案。我试过并解决了:stackoverflow.com/a/23823151/547271
标签: asp.net asp.net-mvc