我的控制器看起来如下:
var _engine = new NopEngine();
var categoryService = _engine.Resolve<ICategoryService>();
var allCategory = categoryService.GetAllCategories();
List<string> ConvertedList = new List<string>();
for (int i = 0; i < allC
我在模特和ViewModels上遇到了一些麻烦。
我需要在同一个视图中列出所有的账单、和用户。(下拉列表中的用户)
还有:什么时候使用IEnumerable<T>?因为取决于我更改视图,更改错误消息。
模型
public class Bill
{
public int Id { get; set; }
public string Title { get; set; }
public DateTime Date { get; set; }
public string Category { get; set; }
public double Am
我想将UserId和UserName列从AspNetUsers表中列出到Admin的EditProfile视图中。
我的EditProfile模型是:
namespace AdminPanelExercises1.Areas.admin.Models
{
public class EditProfileModel
{
public int ID { get; set; }
public string UserID { get; set; }
public string UserName { get; set; }
public str
我试图从成员/角色表中显示一个“角色”列表
我的控制器是:
' GET: /Admin/Index
Function Index() As ActionResult
Dim model = New AdminRoles()
model.Roles = Roles.GetAllRoles()
Return View(model)
End Function
我的模型是:
Imports System.Data.Entity
Imports System.ComponentModel.DataAnnotations
Imports System.ComponentMo
我是MVC的新手,正在尝试在我的视图中使用控制器中的“规则”列表来填充DropDownList。当我按照列出的方式做时,我只得到一个下拉列表,上面有一堆项目,上面写着CellularAutomata.Models.Rules。我知道我这样做是错误的,我只是想知道我如何让它真正显示下拉列表中每个规则的规则描述。
我有一个模型
public class Rule
{
public int ID { get; set; }
public int Name { get; set; }
public string Description{ get; set; }
pub
我正在学习ViewModels在C# ASP.NET MVC 3中的应用,并且在视图中无法显示来自ViewModel的数据。
模型
public class Author
{
public int Id { get; set; }
public string Name { get; set; }
public virtual ICollection<Book> Books { get; set; }
}
public class Book
{
public int Id { get; set; }
public int AuthorId {
所以我需要为一个web应用程序实现一些下拉列表。我使用实体模型将我的web应用程序链接到我的数据库,创建了我所有的类和所有东西。如何创建一个下拉列表,从我的db中的表中的列中填充项?
下面是我尝试使用的一个模型中的一个类:
Partial Public Class gasrevperyear
Public Property ID As Integer
Public Property year As Integer
Public Property amount As Integer
End Class
下面是我想要实现的页面视图中的代码
@ModelType IEnumerab
我有一个以较小的模型作为列表的模型:
public class MostPlayedList
{
public IList<MostPlayed> mostPlayed = new List<MostPlayed>();
public IList<SongNominator> songNominator = new List<SongNominator>();
public IList<MostUpvoted> songsUpvoted = new List<MostUpvoted>();
我对此进行了一些研究,但还没有找到一个可以很好地处理类似情况或MVC3的答案。在我使用的ViewModel中,我有一个单独模型的列表(List<AgentId>,它是AgentId模型的列表)。
在此控制器的Create页面中,我需要一个输入部分,用于将5个项目添加到此列表中。然而,在页面加载之前,我收到了这个错误消息:
There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key 'BankListAgentId[0].StateCode'
提前警告,我对ASP.NET非常陌生。 我正在做一个项目,该项目将显示数据库表中的数据行。当用户单击某一行旁边的"Ignore“按钮时,它应该用数据库中的true更新该行上相应的"Ignore”列。 视图本身运行良好,它可以按预期显示所有数据。但是当"Ignore“被点击,并且它调用控制器上的Ignore()方法时,传递给控制器的模型为空。 我的模型,由实体框架生成(去掉了无关属性): using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
我有一个UserManager页面,管理员可以从同一个页面中获取当前已注册的所有帐户、删除帐户、更新帐户和注册新帐户。
我有一个控制器,它将db.users中的所有用户保存在一个列表中。
public ActionResult UserManager()
{
if (User.IsInRole("1"))
{
var db = new ReviewLogsTestDBEntities();
return View(db.Users.ToList());
}
else
我正在使用EntityFramework在MVC Core中工作。如何在表格中获取视图中的行号?
我的模型是:
public class Provider{
public int ProviderId { get; set; }
public string Name { get; set; }
public int DateOfBirth{ get; set; }
}
控制器是:
public async Task<IActionResult> Index()
{
return View(aw
我有一个MVC应用程序,我试图把它放在一起,需要一些选择列表和下拉列表。
所以,我有以下的模型..。
public class Task
{
public int ID { get; set; }
public string Title { get; set; }
......
public virtual ICollection<Monitor> Monitors { get; set; }
public virtual ICollection<Resource> Resources { get; set; }
}
publi
我有以下ViewModel:
public class ViewModel
{
public Address Address {get;set;}
[DisplayName("State")]
public IEnumerable<SelectListItem> StateSelect { get; set; }
public string StateID { get; set; }
public ViewModel()
{
}
我正在为一个网站使用csvmv4,其中一件事就是ASP.NET导入。我希望将CSV列映射到ORM的属性。上传文件后,我希望显示列号、第一行(包含csv文件中的标题)和第二行(数据预览)。
/// <summary>
/// The mapping view model.
/// </summary>
public class MappingViewModel
{
#region Public Properties
/// <summary>
/// Gets or sets the mappings.
/// </su
我在水平视图中有以下记录。我不能在这里显示确切的布局。但我希望你能理解我在寻求什么帮助。一条记录在一列下,另一条记录在同一行的另一列中,最大值6列应显示在每一行中,这意味着每一行中有6条记录。我有下面的模型
public class Order
{
[Key]
public long id { get; set; }
public DateTime OrderDate { get; set; }
public string Customer { get; set; }
public string Itemname { get; set; }
p
目前,我可以从userRole模型显示razer视图中的所有列。只是好奇我是否喜欢在UserRole Razor视图中显示UserRole列,而不是显示SiteID,这有可能吗?我知道它可以通过自定义视图模型来完成,但是它是必须的吗?如果我错了,请纠正我!
UserRole模型:
public int UserID { get; set; }
public string UserName { get; set; }
public int SiteID { get; set; }
*No SiteName column here....so i only can