Skip to content

Commit 1cab10b

Browse files
committed
Allow null default selected values
1 parent 05d7e48 commit 1cab10b

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

Build/CommonAssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
//
1616
// You can specify all the values or you can default the Revision and Build Numbers
1717
// by using the '*' as shown below:
18-
[assembly: AssemblyVersion("1.0.60.0")]
19-
[assembly: AssemblyFileVersion("1.0.70.0")]
18+
[assembly: AssemblyVersion("1.0.61.0")]
19+
[assembly: AssemblyFileVersion("1.0.61.0")]

Griddly.Mvc/GriddlyFilter.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,18 @@ public void SetSelectedItems(object value)
126126
{
127127
foreach (object valueObject in defaultValues)
128128
{
129-
string valueString = valueObject.ToString();
130-
131-
foreach (SelectListItem item in SelectableItems.Where(x => x.Value == valueString))
132-
item.Selected = true;
129+
if (valueObject != null)
130+
{
131+
string valueString = valueObject.ToString();
132+
133+
foreach (SelectListItem item in SelectableItems.Where(x => x.Value == valueString))
134+
item.Selected = true;
135+
}
136+
else
137+
{
138+
foreach (SelectListItem item in SelectableItems.Where(x => string.IsNullOrWhiteSpace(x.Value)))
139+
item.Selected = true;
140+
}
133141
}
134142
}
135143
}

0 commit comments

Comments
 (0)