根据动态过滤器动态设置脚手架表的默认值 [英] Dynamically set defaults for scaffolded tables according to dynamic filters

查看:81
本文介绍了根据动态过滤器动态设置脚手架表的默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.NET动态数据应用程序,其中包含两个表,即部门 KPI的。捕获KPI时,在列表视图上,将动态过滤器的部门字段设置为例如工厂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.

有什么方法可以导致该下拉菜单在插入视图中对应于动态过滤器中的下拉菜单?我只能看到用户在工厂1上进行过滤,并假设他们添加的任何KPI都将落在工厂1下。

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'.

推荐答案

我想您想要的是单击插入链接时从列表视图中捕获当前过滤条件,并将该过滤条件用作插入页面上的默认值(例如:对于外键关系,下拉列表)

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)"

动态数据期货项目会执行以下操作。签出: http://www.codeplex.com/aspnet/Release /ProjectReleases.aspx?ReleaseId=14475 作为代码。运行 DynamicDataFuturesSample Web项目,然后查看使用来自过滤器的值填充插入模板部分。

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:

使用来自过滤器的值填充插入模板

默认情况下,Dynamic Data不会使用默认值预先填充插入视图中的关系(外键)字段。 DefaultValueHelper类包含帮助程序方法,该方法以以下方式设置动态数据模板:使用URL中的值填充关系字段...

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...

此外,斯蒂芬·诺顿(Stephen Naughton)的博客文章也解决了同样的问题(查询字符串中的筛选条件)

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

这篇关于根据动态过滤器动态设置脚手架表的默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆