File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ public void SetSelectedItems(object value)
126
126
127
127
if ( defaultValues == null || value is string )
128
128
{
129
- string valueString = value . ToString ( ) ; // GetValueString(value);
129
+ string valueString = GetValueString ( value ) ;
130
130
131
131
foreach ( SelectListItem item in SelectableItems )
132
132
item . Selected = item . Value == valueString ;
@@ -137,7 +137,7 @@ public void SetSelectedItems(object value)
137
137
{
138
138
if ( valueObject != null )
139
139
{
140
- string valueString = valueObject . ToString ( ) ; // GetValueString(valueObject);
140
+ string valueString = GetValueString ( valueObject ) ;
141
141
142
142
foreach ( SelectListItem item in SelectableItems . Where ( x => x . Value == valueString ) )
143
143
item . Selected = true ;
@@ -159,6 +159,15 @@ public void SetSelectedItems(object value)
159
159
}
160
160
}
161
161
162
+ string GetValueString ( object value )
163
+ {
164
+ string result = value . ToString ( ) ;
165
+
166
+ if ( value is bool )
167
+ result = result . ToLower ( ) ;
168
+
169
+ return result ;
170
+ }
162
171
//string GetValueString(object value)
163
172
//{
164
173
// Type valueType = Nullable.GetUnderlyingType(value.GetType()) ?? value.GetType();
You can’t perform that action at this time.
0 commit comments