ASP.NET MVC 直接返回js语句,不显示页面

  public ActionResult DetailsFAQ(string projectCode)
        {
            Document document =  new Document();
          
            if (projectCode._IsNullOrEmpty())
            {
                throw new Exception("参数异常!");
            }
            ProjectService projectService = new ProjectService(CurrentUser.Account);
            Project project = projectService.GetProjectByCode(projectCode);
            if (project == null)
            {
                return new ContentResult() { Content = "<script>alert('该FAQ对应的项目为空!'); window.parent.closeModalDialog();</script>" };
            }
     
            return View(document);
        }

posted @ 2018-02-05 16:01  hobby0524  阅读(209)  评论(0编辑  收藏  举报