Dynamically set default values ​​for tables according to dynamic filters

I have an ASP.NET Dynamic Data application that includes two tables, departments, and KPI. When I grab the KPI, in the List view, I set the Department field to a dynamic filter, for example. "Plant 1", but when I add a new KPI, I still need to select "Plant 1" from the drop-down menu.

Is there any way to make the drop-down menu in the "Insert" view correspond to the drop-down list of the dynamic filter? I can just see how users filter “Plant 1”, and if any KPI they add falls under “Plant 1".

0
dynamic-data
source share
1 answer

I think you want to "Grab the current filter criteria from the List list when you click the Insert link and use the filter criteria as the default values ​​on the Insert page (for example: 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 see the section "Filling the insert templates with values ​​from filters"


FROM DynamicDataFutres:
Filling Insert Templates with Values ​​from Filters
By default, dynamic data does not formulate relationship fields (foreign key) in the Insert view with default values. The DefaultValueHelper class contains helper methods that configure dynamic data templates so that the relationship fields are populated using the values ​​from the URL ...


In addition, Stephen Naughton has a blog post that solves the same problem (captures filter criteria from the query string)

http://csharpbits.notaclue.net/2009/01/getting-default-values-from-list-page.html

+2
source share

All Articles