如何从aspx页面打开MVC5视图 [英] How to open MVC5 view from aspx page

查看:183
本文介绍了如何从aspx页面打开MVC5视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Web应用程序MVC5项目的根目录中有一个aspx文件.我可以从"Mvc视图"转到"aspx"文件,但是我被卡在回到mvc视图上.如何从Aspx中的按钮事件返回 ? Fyi,这只是一个空项目,我正在尝试在MVC上学习.因此,一切都保持原样.默认配置.香港专业教育学院的唯一区别是将重定向添加到Home控制器ActionResult中的aspx页面.

Ive got an aspx file on the root of web application MVC5 project. I can go from Mvc View to the aspx file but im stuck on going back to mvc view. How do i go back from button event in Aspx? Fyi, this is just an empty project as im trying to learn on MVC. So everything is left as it is. Default configuration. The only difference that ive made is add redirect to the aspx page inside Home controller ActionResult.

文件夹结构和重定向代码.

Folder Structure and redirect code.

p/s.如果您想知道为什么我在我的mvc中使用了aspx文件,我试图使用reportviewer进行动态rdlc报告.我不确定是否可以使用mvc视图完成此操作.据我所知,剃须刀引擎无法使用reportviewer,这就是为什么我使用aspx文件.我可能在这方面做错了,因为我在做MVC方面还很新.先进的Tqvm.

p/s. If you are wondering why i used an aspx file inside my mvc, im trying to do dynamic rdlc reporting using reportviewer. Im not sure if it could be done using mvc view. As far as i know, razor engine could not use reportviewer and thats why i use an aspx file. Im probably wrong on this as im still very new in doing MVC. Tqvm in advanced.

推荐答案

尝试一下:-

首先更改您的当前代码

public RedirectResult Report()
{
    return Redirect("~/ReportWebForm.aspx");
}

然后在您的.aspx页中添加

And in your .aspx page, add

Response.Redirect("/Controller/Action")

这篇关于如何从aspx页面打开MVC5视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆