根据动态过滤器动态设置支架表的默认值
我有一个 ASP.NET 动态数据应用程序,其中包含两个表:部门 和 KPI。当我捕获 KPI 时,在“列表”视图上,我将动态过滤器的“部门”字段设置为“工厂 1”,但当我添加新的 KPI 时,我仍然必须选择“工厂” 1' 在下拉菜单中。
有什么方法可以使“插入”视图中的下拉列表与动态过滤器中的下拉列表相对应?我只能看到用户在“工厂 1”上进行过滤,并假设他们添加的任何 KPI 都将属于“工厂 1”。
I have an ASP.NET Dynamic Data application that includes two tables, Departments and KPI's. When I capture KPI's, on the 'List' view, I set the Department field of the dynamic filter to e.g. 'Plant 1', but when I add a new KPI, I still have to select 'Plant 1' in a dropdown.
Is there any way I can cause the dropdown in the 'Insert' view to correspond to the dropdown in the dynamic filter? I can just see users filtering on 'Plant 1', and assuming any KPI's they add will fall under 'Plant 1'.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您想要的是“单击插入链接时从列表视图捕获当前过滤条件,并使用该过滤条件作为插入页面上的默认值(例如:对于外键关系,下拉列表)”
动态数据期货项目确实像这样的东西。查看:http://www.codeplex.com/aspnet/Release /ProjectReleases.aspx?ReleaseId=14475 获取代码。运行“DynamicDataFuturesSample”Web 项目并查看“使用过滤器中的值填充插入模板”部分
FROM DynamicDataFutres:
使用过滤器中的值填充插入模板
默认情况下,动态数据不会使用默认值预填充插入视图中的关系(外键)字段。 DefaultValueHelper 类包含帮助程序方法,这些方法设置动态数据模板,以便使用 URL 中的值填充关系字段...
此外,Stephen Naughton 有一篇博客文章解决了相同的问题(从查询中获取过滤条件)字符串)
http://csharpbits.notaclue。 net/2009/01/getting-default-values-from-list-page.html
I think what you want is to "Capture current filter criteria from List view when Insert link is clicked and use that filter criteria as the default values on Insert Page (ex: for foreign key relationships, DropDown Lists)"
The Dynamic Data Futures project does something like this. Check out: http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=14475 for the code. Run the "DynamicDataFuturesSample" web project and look at the section "Populate Insert templates with values from filters"
FROM DynamicDataFutres:
Populate Insert templates with values from filters
By default, Dynamic Data does not prepopulate relationship (foreign key) fields in an Insert view with default values. The DefaultValueHelper class contains helper methods that set up the Dynamic Data templates in such a way that the relationship fields are populated using values from the URL...
Also, Stephen Naughton has a blog post that solves the same problem (grabs filter criteria from query string)
http://csharpbits.notaclue.net/2009/01/getting-default-values-from-list-page.html