简体   繁体   English

是否可以在 ASP.NET MVC Web 应用程序 C# 中“批量”生成视图?

[英]Is it possible to "batch" generate views in an ASP.NET MVC Web Application C#?

Basically, I have a C# MVC Web App, with Controllers that contain methods like this:基本上,我有一个 C# MVC Web 应用程序,其控制器包含如下方法:

public ActionResult A (filters)

public ActionResult B (filters)

public ActionResult C (filters)

Each of these takes in filters, fills a list in the model using data (SQL from Stored Procedure), and generates a View (using DataTables).每一个都接受过滤器,使用数据(来自存储过程的 SQL)在模型中填充一个列表,并生成一个视图(使用数据表)。 As far as the user sees, they click a button (A, B, C, etc.), select their desired filters, click "enter", and this process runs, generating the View (which is basically a report).在用户看来,他们点击一个按钮(A、B、C 等),选择他们想要的过滤器,点击“输入”,这个过程就会运行,生成视图(基本上是一个报告)。 The user can repeatedly go through this process, and each of these views/reports is generated above the other(s) on the page (they can scroll up and down).用户可以重复执行此过程,并且这些视图/报告中的每一个都在页面上的其他视图/报告之上生成(它们可以上下滚动)。 What I want to do, is have a different button --> filter page where they only select a "batch" of these reports they want generated.我想要做的是有一个不同的按钮 --> 过滤页面,他们只选择他们想要生成的这些报告的“批次”。 So if the user selects the option 'Batch 1', it generates Report A (with filters I define), then generates Report B (pre defined filters), then generates Report C (pre defined filters), ideally without any addition inputs from the user being needed.因此,如果用户选择选项“批次 1”,它会生成报告 A(使用我定义的过滤器),然后生成报告 B(预定义的过滤器),然后生成报告 C(预定义的过滤器),理想情况下没有来自需要的用户。

Initially, I had been hoping to have some sort of "Super Controller", that would call ActionResult A, which would run through its process and generate the View.最初,我一直希望有某种“超级控制器”,它会调用 ActionResult A,它会运行整个过程并生成视图。 Then, instead of ending, it would return back to this "Super Controller" where it would then Call ActionResult B and run though the process, generating the view, etc. However, I'm now wondering if this is even possible in MVC.然后,它不会结束,而是返回到这个“超级控制器”,然后调用 ActionResult B 并运行整个过程,生成视图等。但是,我现在想知道这在 MVC 中是否可行。 I do feel like something along the lines if this is the most "logical" solution, but it doesn't seem like Controller will let you implement something like this (at least in the ways I've tried).如果这是最“合乎逻辑”的解决方案,我确实觉得有点类似,但似乎 Controller 不会让您实现这样的东西(至少以我尝试过的方式)。 I've also tried to implement Tasks, but the only thing I was able to do with that was create 1 enormous view/report, which won't work for what I need (which is to generate lots of individual views, which each contain the ability to export to PDF, etc. via DataTables).我也尝试过实现任务,但我唯一能做的就是创建 1 个巨大的视图/报告,这不能满足我的需要(即生成许多单独的视图,每个视图都包含通过 DataTables 导出为 PDF 等的能力)。 If anyone could point me towards some sort of solution/ideas to do this it would be greatly appreciated.如果有人可以向我指出某种解决方案/想法来做到这一点,我将不胜感激。 Please let me know if more info is needed.如果需要更多信息,请告诉我。

You should see actions from controllers as entry points for your http requests.您应该看到从控制器为切入点的http请求的行动。 So, each request is mapped to one action, so this should not be possible, and you should not think of doing it this way.所以,每个请求都映射到一个动作,所以这应该是不可能的,你不应该想到这样做。

It would be better to have on action that receives the data needed to be able to generate the uber report.最好采取行动来接收能够生成超级报告所需的数据。

暂无
暂无

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

相关问题 是否可以在C#ASP.NET Web应用程序中执行此操作? - Is it possible to do this in a C# ASP.NET Web Application? ASP.NET,MVC,C#应用程序-为不同的视图修改_Layout.cshtml - ASP.NET, MVC, C# application - modify _Layout.cshtml for different Views 如何使用C#.net为Windows应用程序和使用C#ASP.NET的Web应用程序生成Excel文件 - how to generate excel file for a windows application using C# .net and a web application using C# ASP.NET 强制C# ASP.NET MVC web应用重新读取web.config IPSettings - Force C# ASP.NET MVC web application to re-read web.config IPSettings 如何使用C#在ASP.net Web应用程序的div中动态生成imagebutton? - How to dynamically generate imagebutton in div in ASP.net web application using C#? ASP.NET MVC3 / Razor C#两侧/界面Web应用程序 - ASP.NET MVC3/Razor C# two sides/interfaces web application 如何以编程方式修改 ASP.NET MVC 和 C# 应用程序中的 web.config? - How to programmatically modify web.config in ASP.NET MVC and C# application? 如何在ASP.NET MVC Web应用程序的C#中管理图像文件 - how to manage image file in c# for asp.net mvc web-application C#/ ASP.NET MVC:如果我知道用户名和密码,如何在其他Web应用程序中注册/登录? - C#/ASP.NET MVC: how to register/log in a different web application if I know username & password? 如何在Asp.net MVC Web应用程序c#中上传文件时显示进度? - How to show the progress while uploading a file in Asp.net MVC web application, c#?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM