简体   繁体   English

如何将项目添加到列表中<T>从控制器中的表单输入而不使用视图? ASP.NET MVC C#

[英]How can I add items to a list<T> from form input in a controller without using views? ASP.NET MVC C#

I have a list of type我有一个类型列表

I am generating html in the browser on submit我在提交时在浏览器中生成 html

I need the submitted information to be added to the list我需要将提交的信息添加到列表中

你如何从视图中保存数据而不使用视图问题有点模糊你能不能更具体一点,如果你想将传入的模型/视图数据添加到控制器列表只需初始化列表添加它并进行任何数据操作如果需要根据要求并将其保存为 dB 或根据您的要求。

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

相关问题 如何让我的控制器从他在 ASP.NET MVC 中的一个视图中捕获表单提交的数据 - How can I make my controller catch the data submitted by a form from one of his views in ASP.NET MVC 如何将项目从结构 asp.net c# 添加到下拉列表 - How can I add items to a dropdownlist from a struct asp.net c# C#-ASP.NET MVC从表单到控制器获取数据,我得到一个空对象 - C# - ASP.NET MVC Get data from form to controller, I get an empty object 如何从 C#、ASP.net 添加 HTML 输入 - How can i add HTML input from C#, ASP.net 如何仅将项目添加到以前未添加的列表中? (C# - ASP.NET) - How to only add items to a list that haven't been added before? (C# - ASP.NET) 如何在ASP.Net MVC的视图内将项目添加到视图模型的列表中? - How can I add items to a list in my View Model within a View in ASP.Net MVC? 如何绑定列表 <T> 在ASP.Net MVC C#的表单发布中 - How to bind List<T> on Form Post in ASP.Net MVC C# 将新列表项添加到列表 <T> 在MVC,Razor,ASP.NET中使用表单 - Add new list items to a List<T> in MVC, Razor, ASP.NET with form 如何使用 ASP.NET MVC C# Html 从视图中调用控制器中的函数 - How to call a function in the controller from the view using ASP.NET MVC C# Html 如何覆盖从基本控制器asp.net c#继承的动作控制器? - How can I override an action controller that inherited from a base controller asp.net c#?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM