感谢您花时间帮助我。我是c#和MVC的新手
经过多方研究。我创建了Code First模型:using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace CFMembers.Models
{
public class Table1
{
public int Table1Id { get; set; }
public string Title { get; set; }
public DateTime ReleaseDate { get; set; }
public String Genre { get; set; }
public Decimal Price { get; set; }
public string Rating { get; set; }
public int Table2Id { get; set; }
[ForeignKey("Table2Id")]
public Table2 link { get; set; }
public List<Table1> Table1List { get; set; }
}
public class Table2
{
public int Table2Id { get; set; }
public string Review { get; set; }
public string line2 { get; set; }
public string line3 { get; set; }
public string line4 { get; set; }
public string line5 { get; set; }
public string line6 { get; set; }
}
}
这是非常基本的。但是,我已经为两个表创建了默认控制器,它们似乎通过下拉框关联就好了。
现在我被卡住了。 (请原谅我糟糕的描述)我想显示Table1中的数据。从Table1中选择一行时,这将更新一个显示Table2相关数据的网格(webgrid?)。
如果有人可以发布我可以关注的示例链接,我将非常感激。或指出我正确的方向