diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Projections/TermsFilter.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Projections/TermsFilter.cs index f07415f8bad..4a020f1ec65 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Projections/TermsFilter.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Projections/TermsFilter.cs @@ -36,7 +36,10 @@ public void ApplyFilter(dynamic context) { var termIds = (string)context.State.TermIds; if (!String.IsNullOrEmpty(termIds)) { - var ids = termIds.Split(new[] { ',' }).Select(Int32.Parse).ToArray(); + var ids = termIds.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries) + // Int32.Parse throws for empty strings + .Where(x => !string.IsNullOrWhiteSpace(x)) + .Select(Int32.Parse).ToArray(); if (ids.Length == 0) { return; diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Projections/TermsFilterForms.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Projections/TermsFilterForms.cs index c6cc27a4baf..8ce95cdb347 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Projections/TermsFilterForms.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Projections/TermsFilterForms.cs @@ -57,7 +57,8 @@ public void Describe(dynamic context) { ); foreach (var taxonomy in _taxonomyService.GetTaxonomies()) { - f._Terms.Add(new SelectListItem { Value = String.Empty, Text = taxonomy.Name }); + var tGroup = new SelectListGroup { Name = taxonomy.Name }; + f._Terms.Add(tGroup); foreach (var term in _taxonomyService.GetTerms(taxonomy.Id)) { var gap = new string('-', term.GetLevels()); @@ -65,7 +66,11 @@ public void Describe(dynamic context) { gap += " "; } - f._Terms.Add(new SelectListItem { Value = term.Id.ToString(), Text = gap + term.Name }); + f._Terms.Add(new SelectListItem { + Value = term.Id.ToString(), + Text = gap + term.Name, + Group = tGroup + }); } }