Free cookie consent management tool by TermsFeed Policy Generator

source: branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Views/Filter/Filters.ascx @ 6102

Last change on this file since 6102 was 6102, checked in by dhohl, 13 years ago

#1499 query filter
recursive layout of the filters

File size: 2.4 KB
Line 
1<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
2<%@ Import Namespace="HLWebOKBQueryPlugin.Models" %>
3<%@ Import Namespace="HLWebOKBQueryPlugin.OKBQueryService" %>
4<!-- Put all into a form that calls the "AddFilter" Action-->
5<% using (Html.BeginForm ("AddFilter", "Filter")) %>
6<% { %>
7<p>
8    Select Filter:
9    <%: Html.DropDownList("filtersCombobox", new SelectList(((FilterModel)Model).Filters, "FilterTypeName", "Label"))%>
10    <input type="submit" value="add" />
11</p>
12<ul>
13    <!-- Build the selected filters. The filtesr will be stored in the session and the
14Controller puts the current filters from the session into the model. Selected Filters
15will be iterated. -->
16    <% if (((FilterModel)Model).SelectedFilters != null)
17       {
18
19           foreach (Filter f in ((FilterModel)Model).SelectedFilters)
20           { %>
21    <li>
22        <%
23                // If type is StringComparisonFilter build thes controls
24                if ("StringComparisonFilter".Equals(f.GetType().Name))
25                {  %>
26                    <%: Html.TextBox("valueTextbox." + f.GetType().Name, ((StringComparisonFilter)f).Value)%>
27                    <%: Html.LabelFor(x => f.Label)%>
28                   
29             <% }
30               // If type is NameStringComparisonFilter build thes controls
31               else if ("NameStringComparisonFilter".Equals(f.GetType().Name))
32               { %>
33                    <%: Html.TextBox("valueTextbox." + f.GetType().Name, ((NameStringComparisonFilter)f).Value) %>
34                   
35             <% }
36               else if ("CombinedFilter".Equals(f.GetType().Name))
37               { %>
38                <% CombinedFilter combiFilter = ((CombinedFilter)f);  %>
39                 <% List<Filter> comtbiFtilterLis = combiFilter.Filters.ToList<Filter>();
40                    FilterModel m = new FilterModel();
41                    m.Filters = ((FilterModel)Model).Filters;
42                    m.SelectedFilters = comtbiFtilterLis;
43                    %>
44                    <%   Html.RenderPartial("Filters", m); %>
45                   
46             <% }
47
48
49              else
50                { %>
51                     <!-- type not supported ... -->
52                     FilerTypeName =
53                    <%: Html.Label(f.GetType().Name)%>
54               <% }
55               %>
56    </li>
57    <% }
58
59       }
60   }%>
61</ul>
Note: See TracBrowser for help on using the repository browser.