0

我需要创建方法(或您推荐的其他方法),以便过滤两个下拉列表中的数据。我的情况如下:

1) 数据库访问业务类 (CRUD)

2)两个DropDownList(一个GridView里面)

第一个显示组文章,而第二个项目根据第一个中的选择填充第二个。

数据库表包括以下内容:

1) 表组

2) 相关项目表

表的报表是一对多的,或者一组可以有很多篇文章,都有自己的主键。

你给我什么建议?

谢谢你们,

里卡多。

4

1 回答 1

0

我认为您只需要两种方法:

- GetAllGroups(): That call Entity framework to get all groups from db
- GetArticlesByGroupID(<<groupID>>): that get articles from db based on what groups was chosen

您的程序的主要流程将是:

- after form is initialized, you can method GetAllGroups() and populate into first dropdownlist

- in event selected changed of first dropdownlist and call method GetArticleByGroupID(...) and populate into second dropdownlist

这一切。

从实体框架视图:您需要创建任何需要的对象或 DTO,例如 groupDTO、ArticleDTO、GroupRespository... 或类似的东西希望可以帮助您

于 2013-06-04T05:54:31.083 回答