Last post Apr 14, 2014 12:43 PM by sjnaughton
Apr 14, 2014 06:26 AM|kopdicht|LINK
I'm developing a ASP .NET Application using Web Forms and i'm trying to implement Dynamic Data Scaffolding.
I have successfully implemented it in a Multi-Project Solution.
My problem right now is how can i customize the queries used in Dynamic Data "Views".
For example for the List.aspx if I only want to show the items that have a certain value in a certain "column" how can i add a where clause to the queries used/generated by Dynamic Data?
Apr 14, 2014 07:28 AM|kopdicht|LINK
I think I found a solution even though i don't know if it is the best one but....
In the List.aspx there is a QueryExtender so if i add a CustomExpression i can than specify a query expression to be used.
<asp:QueryExtender TargetControlID="GridDataSource" ID="GridQueryExtender" runat="server">
<asp:DynamicFilterExpression ControlID="FilterRepeater" />
<asp:CustomExpression OnQuerying="FilterStuff" />
After that i created a custom partial class in ~/DynamicData/CustomPages/Things/List.aspx.cs
public partial class List
protected void FilterStuff(object sender, CustomExpressionEventArgs e)
e.Query = from p in e.Query.Cast<Things>()
where p.ID >= 12
Hope it helps someone eith the same problem .
Apr 14, 2014 12:43 PM|sjnaughton|LINK
your best bet wouold be to use Model binding sadly we don't have a scaffolding solution for that at the moment.