<div class="votingouterbox"> <div class="voting">I'm using a Profile parameter
set at login as a value for filtering Gridview data of Entity Framework Dynamic Data application. The QueryExtender seems works fine on the Gridview portion but leaves the dropdown menus automatically generated by DD unfiltered. After reading many articles,
I've almost concluded that this is not possible. Can anyone please tell me if DD is capable of filtering the dropdown filters using Profile variable? If so, how? Thanks.</div> </div>
Below is partial aspx code.
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true">
<DataControls>
<asp:DataControlReference ControlID="GridView1" />
</DataControls>
</asp:DynamicDataManager>
<h2 class="DDSubHeader"><%= table.DisplayName%></h2>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:QueryableFilterRepeater runat="server" ID="FilterRepeater">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("DisplayName") %>' OnPreRender="Label_PreRender" />
<asp:DynamicFilter runat="server" ID="DynamicFilter" OnFilterChanged="DynamicFilter_FilterChanged" /><br />
</ItemTemplate>
</asp:QueryableFilterRepeater>
<div class="DD">
<asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true"
HeaderText="List of validation errors" CssClass="DDValidator" />
<asp:DynamicValidator runat="server" ID="GridViewValidator" ControlToValidate="GridView1" Display="None" CssClass="DDValidator" />
<br />
</div>
<asp:GridView ID="GridView1" runat="server" DataSourceID="GridDataSource" EnablePersistedSelection="true"
AllowPaging="True" AllowSorting="True" CssClass="DDGridView"
RowStyle-CssClass="td" HeaderStyle-CssClass="th" CellPadding="6">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:DynamicHyperLink runat="server" Action="Edit" Text="Edit"
/> <asp:LinkButton runat="server" CommandName="Delete" Text="Delete"
OnClientClick='return confirm("Are you sure you want to delete this item?");'
/> <asp:DynamicHyperLink runat="server" Text="Details" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle CssClass="DDFooter"/>
<PagerTemplate>
<asp:GridViewPager runat="server" />
</PagerTemplate>
<EmptyDataTemplate>
There are currently no items in this table.
</EmptyDataTemplate>
</asp:GridView>
<asp:EntityDataSource ID="GridDataSource" runat="server" EnableDelete="true" />
<%-- Important to filter on Company from Profile setting--%>
<asp:QueryExtender TargetControlID="GridDataSource" ID="GridQueryExtender" runat="server">
<asp:DynamicFilterExpression ControlID="FilterRepeater" />
<asp:SearchExpression DataFields="Company" SearchType="startswith">
<asp:ProfileParameter PropertyName="Company" />
</asp:SearchExpression>
</asp:QueryExtender>
<br />
Can the push-button be hidden and automated so that a user will not have to even depress it? Perhaps employ the Page_Load section to accomplish this? Any examples would be appreciated as I'm still learning.
Can the push-button be hidden and automated so that a user will not have to even depress it?
Why do you want the push-button be hidden?If you hide the button, there's no submit action to the webpage itself so that the records cannot be filtered out.
Maybe you can make your Dropdownlist's AutoPostBack=true, or some controls' AutoPostBack=true.
All in all,you should have to submit back to the page itself.
bja58
Member
6 Points
9 Posts
Can Profile Parameter be used to affect AutoFilters in Dynamic Data?
Aug 27, 2012 04:26 PM|LINK
Below is partial aspx code.
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true"> <DataControls> <asp:DataControlReference ControlID="GridView1" /> </DataControls> </asp:DynamicDataManager> <h2 class="DDSubHeader"><%= table.DisplayName%></h2> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:QueryableFilterRepeater runat="server" ID="FilterRepeater"> <ItemTemplate> <asp:Label runat="server" Text='<%# Eval("DisplayName") %>' OnPreRender="Label_PreRender" /> <asp:DynamicFilter runat="server" ID="DynamicFilter" OnFilterChanged="DynamicFilter_FilterChanged" /><br /> </ItemTemplate> </asp:QueryableFilterRepeater> <div class="DD"> <asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true" HeaderText="List of validation errors" CssClass="DDValidator" /> <asp:DynamicValidator runat="server" ID="GridViewValidator" ControlToValidate="GridView1" Display="None" CssClass="DDValidator" /> <br /> </div> <asp:GridView ID="GridView1" runat="server" DataSourceID="GridDataSource" EnablePersistedSelection="true" AllowPaging="True" AllowSorting="True" CssClass="DDGridView" RowStyle-CssClass="td" HeaderStyle-CssClass="th" CellPadding="6"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:DynamicHyperLink runat="server" Action="Edit" Text="Edit" /> <asp:LinkButton runat="server" CommandName="Delete" Text="Delete" OnClientClick='return confirm("Are you sure you want to delete this item?");' /> <asp:DynamicHyperLink runat="server" Text="Details" /> </ItemTemplate> </asp:TemplateField> </Columns> <PagerStyle CssClass="DDFooter"/> <PagerTemplate> <asp:GridViewPager runat="server" /> </PagerTemplate> <EmptyDataTemplate> There are currently no items in this table. </EmptyDataTemplate> </asp:GridView> <asp:EntityDataSource ID="GridDataSource" runat="server" EnableDelete="true" /> <%-- Important to filter on Company from Profile setting--%> <asp:QueryExtender TargetControlID="GridDataSource" ID="GridQueryExtender" runat="server"> <asp:DynamicFilterExpression ControlID="FilterRepeater" /> <asp:SearchExpression DataFields="Company" SearchType="startswith"> <asp:ProfileParameter PropertyName="Company" /> </asp:SearchExpression> </asp:QueryExtender> <br />Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Can Profile Parameter be used to affect AutoFilters in Dynamic Data?
Aug 29, 2012 01:54 AM|LINK
Hi,
I think it should work:
1)Please define your Profile like this following:
File: Web.config <configuration> …………………… <system.web> <profile enabled="true"> <properties> <add name="Company" defaultValue="Anonymous" /> </properties> </profile> </system.web> </configuration>And then put a submit button,when click that,the whole page is submitted and it will filter the records according to the profile's configration……
bja58
Member
6 Points
9 Posts
Re: Can Profile Parameter be used to affect AutoFilters in Dynamic Data?
Aug 29, 2012 03:04 PM|LINK
Thanks Decker I'll try that.
Can the push-button be hidden and automated so that a user will not have to even depress it? Perhaps employ the Page_Load section to accomplish this? Any examples would be appreciated as I'm still learning.
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Can Profile Parameter be used to affect AutoFilters in Dynamic Data?
Aug 30, 2012 01:15 AM|LINK
Why do you want the push-button be hidden?If you hide the button, there's no submit action to the webpage itself so that the records cannot be filtered out.
Maybe you can make your Dropdownlist's AutoPostBack=true, or some controls' AutoPostBack=true.
All in all,you should have to submit back to the page itself.
Reguards!