简体   繁体   English

ASP.NET MVC从ASPX页面的代码隐藏返回数据

[英]Asp.net mvc return data from codebehind of aspx page

Hi there I have a situation where I need to make to call to a normal .aspx page from asp.net mvc web application. 嗨,我有一种情况,需要从asp.net mvc Web应用程序调用普通的.aspx页面。 How can I make this request and get data back from the page. 如何提出此请求并从页面中获取数据。 the data will be returned on on the page_load event of the .aspx page 数据将在.aspx页的page_load事件上返回

Well... you can redirect to the aspx page from an action result. 好吧...您可以将操作结果重定向到aspx页面。 For Example 例如

    public ActionResult GoOldSchool() {
        Redirect("watever.aspx");
        return View();
    }

Where did you want to send the data? 您想将数据发送到哪里? To a model? 要模特儿? You can post back to the controller using routing for wherever the aspx is located if that is what you need. 如果需要,您可以使用路由将aspx放回的位置发回控制器。

I think to keep the 2 "technologies" separate, you should use query parameters to pass data back and forth. 我认为要将两种“技术”分开,应该使用查询参数来回传递数据。

Send the id to load the data from the aspx page and perform some actions on the data. 发送ID以从aspx页面加载数据并对该数据执行一些操作。 Post to your asp.net mvc action with that same id and load the data. 使用相同的ID发布到您的asp.net mvc操作并加载数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM