@@ -107,26 +107,41 @@ public static HtmlString AttributeIf(this HtmlHelper helper, string name, bool s
107
107
public static void SetGriddlyDefault < T > ( this Controller controller , ref T parameter , string field , T value )
108
108
{
109
109
if ( controller . ControllerContext . IsChildAction )
110
- parameter = value ;
110
+ {
111
+ if ( EqualityComparer < T > . Default . Equals ( parameter , default ( T ) ) )
112
+ parameter = value ;
111
113
112
- controller . ViewData [ "_griddlyDefault_" + field ] = value ;
114
+ controller . ViewData [ "_griddlyDefault_" + field ] = parameter ;
115
+ }
116
+ else
117
+ controller . ViewData [ "_griddlyDefault_" + field ] = value ;
113
118
}
114
119
115
120
public static void SetGriddlyDefault < T > ( this Controller controller , ref T [ ] parameter , string field , IEnumerable < T > value )
116
121
{
117
122
if ( controller . ControllerContext . IsChildAction )
118
- parameter = value . ToArray ( ) ;
123
+ {
124
+ if ( parameter == null )
125
+ parameter = value . ToArray ( ) ;
119
126
120
- controller . ViewData [ "_griddlyDefault_" + field ] = value ;
127
+ controller . ViewData [ "_griddlyDefault_" + field ] = parameter ;
128
+ }
129
+ else
130
+ controller . ViewData [ "_griddlyDefault_" + field ] = value ;
121
131
}
122
132
123
133
public static void SetGriddlyDefault < T > ( this Controller controller , ref T ? [ ] parameter , string field , IEnumerable < T > value )
124
134
where T : struct
125
135
{
126
136
if ( controller . ControllerContext . IsChildAction )
127
- parameter = value . Cast < T ? > ( ) . ToArray ( ) ;
137
+ {
138
+ if ( parameter == null )
139
+ parameter = value . Cast < T ? > ( ) . ToArray ( ) ;
128
140
129
- controller . ViewData [ "_griddlyDefault_" + field ] = value ;
141
+ controller . ViewData [ "_griddlyDefault_" + field ] = parameter ;
142
+ }
143
+ else
144
+ controller . ViewData [ "_griddlyDefault_" + field ] = value ;
130
145
}
131
146
132
147
public static object GetGriddlyDefault ( this WebViewPage page , string field )
0 commit comments