Last post Aug 28, 2008 01:26 AM by davidebb
Aug 26, 2008 04:58 PM|Adult|LINK
In my current solution,instead delete, i mark records IsDeleted = true.
In metadata IsDeleted column (scatfold = false). But it still show in Filters.
Also Dynamic Data generated site show those deleted records. Can I apply filter to select everything IsDeleted==false?
I can probably override OnSelecting on LinqDataSource,but then i have to do it on each Custom page.
Any other ideas?
Aug 26, 2008 06:32 PM|jheyse|LINK
I don't believe the ScafoldColumn applies to the FilteringRepeater. You can accomplish this by hiding the controls.
<asp:FilterRepeater ID="FilterRepeater" runat="server">
<asp:Label runat="server" Text='<%# Eval("DisplayName") %>' Visible='<%# ((string)Eval("DisplayName")).Trim() != "IsDeleted" %>' AssociatedControlID="DynamicFilter$DropDownList1" />
<asp:DynamicFilter runat="server" ID="DynamicFilter" Visible='<%# ((string)Eval("DisplayName")).Trim() != "IsDeleted" %>' OnSelectedIndexChanged="OnFilterSelectedIndexChanged" />
<FooterTemplate><br /><br /></FooterTemplate>
To always hide the deleted columns add a static parameter to the LinqDataSource.
<asp:LinqDataSource ID="GridDataSource" runat="server" EnableDelete="true"> <WhereParameters> <asp:DynamicControlParameter ControlID="FilterRepeater" /> <asp:Parameter Name="IsDeleted" Type="Boolean" DefaultValue="false" /> </WhereParameters> </asp:LinqDataSource>
Aug 27, 2008 11:48 PM|Adult|LINK
Using your sample im getting
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
I dont have any IsDeleted1 property, any idea why im getting this error?
Aug 28, 2008 01:26 AM|davidebb|LINK
I think the reason for this behavior is that even though you hide the IsDeleted filter, it's still there and affecting the datasource. Then when you add the explicit IsDeleted parameter, it conflicts in some way in the data source and one of them gets rename.
I know, that's a bit quirky, but I think it's something along those lines.
I would try to get rid of that filter altogether. If you look in the Dynamic Data Futures solution on CodePlex, it has a FilterAttribute which can do this.