- Timestamp:
- 05/07/11 10:41:02 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Views/Filter/Filters.ascx
r6118 r6141 3 3 <%@ Import Namespace="HLWebOKBQueryPlugin.OKBQueryService" %> 4 4 <!-- Put all into a form that calls the "AddFilter" Action--> 5 <% using (Html.BeginForm ("AddFilter", "Filter")) %>6 <% { %>7 5 <p> 6 <% 7 CombinedFilter currentFilter = ((FilterModel)Model).Content; 8 %> 9 <% using (Html.BeginForm("AddFilterAnd", "Filter", FormMethod.Post, new { id = currentFilter.Id, name = currentFilter.Id })) %> 10 <% { %> 11 <% 12 13 string comboboxName = "filtersCombobox." + currentFilter.Id; 14 string hiddenName = "parentId." + currentFilter.Id; 15 %> 16 8 17 Select Filter: 9 <%: Html. DropDownList("filtersCombobox", new SelectList(((FilterModel)Model).Filters, "FilterTypeName", "Label"))%>10 < input type="submit" value="add" />11 18 <%: Html.Hidden(hiddenName,currentFilter.Id.ToString()) %> 19 <%: Html.DropDownList(comboboxName, new SelectList(((FilterModel)Model).Filters, "FilterTypeName", "Label"))%> 20 <input type="submit" value="+" /> 12 21 </p> 13 <ul> 14 <!-- Build the selected filters. The filtesr will be stored in the session and the 22 <!-- Build the selected filters. The filtesr will be stored in the session and the 15 23 Controller puts the current filters from the session into the model. Selected Filters 16 24 will be iterated. --> 17 <% if (((FilterModel)Model).SelectedFilters != null) 25 <% if (currentFilter.Filters != null) 26 { 27 28 foreach (Filter f in currentFilter.Filters) 18 29 { 19 20 foreach (Filter f in ((FilterModel)Model).SelectedFilters) 21 { %> 22 <li> 23 <% 24 // If type is StringComparisonFilter build thes controls 25 if ("StringComparisonFilter".Equals(f.GetType().Name)) 26 { %> 27 <%: Html.TextBox("valueTextbox." + f.GetType().Name, ((StringComparisonFilter)f).Value)%> 28 <%: Html.LabelFor(x => f.Label)%> 29 30 <% } 31 // If type is NameStringComparisonFilter build thes controls 32 else if ("NameStringComparisonFilter".Equals(f.GetType().Name)) 33 { %> 34 <%: Html.TextBox("valueTextbox." + f.GetType().Name, ((NameStringComparisonFilter)f).Value) %> 35 36 <% } 37 else if ("CombinedFilter".Equals(f.GetType().Name)) 38 { %> 39 <% CombinedFilter combiFilter = ((CombinedFilter)f); %> 40 <% List<Filter> comtbiFtilterLis = combiFilter.Filters.ToList<Filter>(); 41 FilterModel m = new FilterModel(); 42 m.Filters = ((FilterModel)Model).Filters; 43 m.SelectedFilters = comtbiFtilterLis; 44 %> 45 <% Html.RenderPartial("Filters", m); %> 46 47 <% } 30 if (f != null) 31 { %> 32 <div> 33 <% 34 35 // If type is StringComparisonFilter build thes controls 36 if ("StringComparisonFilter".Equals(f.GetType().Name)) 37 { %> 38 <%: Html.TextBox(f.Id + ".valueTextbox", ((StringComparisonFilter)f).Value)%> 39 <%: Html.Label(f.GetType().Name)%> 40 <% } 41 // If type is NameStringComparisonFilter build thes controls 42 else if ("NameStringComparisonFilter".Equals(f.GetType().Name)) 43 { %> 44 <%: Html.TextBox(f.Id + ".valueTextbox" + f.Id, new{((NameStringComparisonFilter)f).Value})%> 45 <%: Html.Label(f.GetType().Name)%> 46 <% } 48 47 49 48 50 else 51 { %> 52 <!-- type not supported ... --> 53 FilerTypeName = 54 <%: Html.Label(f.GetType().Name)%> 55 <% } 56 %> 57 </li> 49 else 50 { %> 51 <!-- other types ... must be implemented --> 52 <%: Html.Label(f.GetType().Name)%> 58 53 <% } 59 54 %> 55 </div> 56 <% } 60 57 } 61 58 }%> 62 </ul> 59 <% } 60 61 %>
Note: See TracChangeset
for help on using the changeset viewer.