diff --git a/projects/Infrastructure/Views/Shared/Search.cshtml b/projects/Infrastructure/Views/Shared/Search.cshtml index 5789e657..80e23ac5 100644 --- a/projects/Infrastructure/Views/Shared/Search.cshtml +++ b/projects/Infrastructure/Views/Shared/Search.cshtml @@ -4,31 +4,46 @@ @foreach (var prop in ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForEdit)) { var uihit = prop.TemplateHint ?? prop.DataTypeName; - var name="query."+prop.PropertyName; - if (prop.PropertyName == "Id" || prop.PropertyName == "DisplayOrder" || uihit == "ImageUrl"||uihit=="MultiSelectList") + var name = "query." + prop.PropertyName; + if (prop.PropertyName == "Id" || prop.PropertyName == "DisplayOrder" || uihit == "ImageUrl" || uihit == "MultiSelectList") { continue; } else { -
-
- -
- @if (prop.ModelType == typeof(string)){ - @Html.TextBox(prop.PropertyName, null, new { name=name,@class = inputClass }) - } - else if(prop.UnderlyingOrModelType == typeof(bool)) - { - var items=new List(){new SelectListItem{ Value="true",Text="是"},new SelectListItem{Value="false",Text="否"}}; - var list = new SelectList(items, "Value", "Text"); - @Html.DropDownList(prop.PropertyName, list,"请选择", new { @class = inputClass }) - } - else{ - @Html.Editor(prop.PropertyName, prop.DataTypeName ?? prop.TemplateHint, prop.AdditionalValues) - } -
+
+
+ +
+ @if (prop.ModelType == typeof(string) || + prop.UnderlyingOrModelType == typeof(Int32) || + prop.UnderlyingOrModelType == typeof(Int64)|| + prop.UnderlyingOrModelType == typeof(System.Single)|| + prop.UnderlyingOrModelType == typeof(System.Double)|| + prop.UnderlyingOrModelType == typeof(System.Decimal)) + { + @Html.TextBox(prop.PropertyName, null, new { name=name,@class = inputClass }) + } + else if(prop.IsNullableValueType&&prop.UnderlyingOrModelType == typeof(bool)) + { + var items=new List(){new SelectListItem{ Value="true",Text="是"},new SelectListItem{Value="false",Text="否"}}; + var list = new SelectList(items, "Value", "Text"); + @Html.DropDownList(prop.PropertyName, list,"请选择", new { @class = inputClass }) + } + else if(prop.IsNullableValueType&&prop.IsEnum) + { + var items=Enum.GetValues(prop.UnderlyingOrModelType).Cast() + .Select(o => new SelectListItem { Value = o.GetValue().ToString(), Text = o.GetDisplayName() }) + .ToList(); + var list = new SelectList(items, "Value", "Text"); + @Html.DropDownList(prop.PropertyName, list,"请选择", new { @class = inputClass }) + } + else + { + @Html.Editor(prop.PropertyName, prop.DataTypeName ?? prop.TemplateHint, prop.AdditionalValues) + }
- } +
+} } \ No newline at end of file diff --git a/projects/Platform/Platform.csproj b/projects/Platform/Platform.csproj index 27c9a7ae..e0e4102e 100644 --- a/projects/Platform/Platform.csproj +++ b/projects/Platform/Platform.csproj @@ -4,7 +4,7 @@ Zh-CN true true - 1.1.0.9 + 1.1.0.10