无法从MVC中的网址参数获取值

时间:2020-04-09 11:19:10

标签: c# asp.net-mvc

 This is my url:  http://localhost:58897/User/ApprovalPlans?type=1


 [LogonAuthorize]
    public ActionResult GetValuesToBindForPlanStatus(int LoggedInID = 0,int type=0)
    {
        string param1 = this.Request.QueryString["type"];
        using (var usersBal = new UsersBal())
        {
             var model = usersBal.GetValuesToBindForPlanStatus(LoggedInID,Convert.ToInt32(param1));
             return Json(model, JsonRequestBehavior.AllowGet);
        }
    }

上面是我的控制器代码。当我单击链接时,它将打开url,然后转到此操作方法。但是,当我使用字符串param1 = this.Request.QueryString [“ type”];时,我将得到null。请帮助我

0 个答案:

没有答案
相关问题