Browse Source

Merge pull request #16737 from Sjhzjxc/fix-route-values-is-null

Fix RouteValues must not be null error
pull/16747/head
Engincan VESKE 3 years ago
committed by GitHub
parent
commit
e4fae55382
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelper.cs

22
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelper.cs

@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Mvc.ViewFeatures;
@ -21,6 +22,8 @@ public class AbpDynamicFormTagHelper : AbpTagHelper<AbpDynamicFormTagHelper, Abp
public bool? RequiredSymbols { get; set; } = true; public bool? RequiredSymbols { get; set; } = true;
#region MvcFormTagHelperAttiributes #region MvcFormTagHelperAttiributes
private IDictionary<string, string> _routeValues;
private const string ActionAttributeName = "asp-action"; private const string ActionAttributeName = "asp-action";
private const string AreaAttributeName = "asp-area"; private const string AreaAttributeName = "asp-area";
@ -57,7 +60,22 @@ public class AbpDynamicFormTagHelper : AbpTagHelper<AbpDynamicFormTagHelper, Abp
public string Method { get; set; } public string Method { get; set; }
[HtmlAttributeName(RouteValuesDictionaryName, DictionaryAttributePrefix = RouteValuesPrefix)] [HtmlAttributeName(RouteValuesDictionaryName, DictionaryAttributePrefix = RouteValuesPrefix)]
public IDictionary<string, string> RouteValues { get; set; } public IDictionary<string, string> RouteValues
{
get
{
if (_routeValues == null)
{
_routeValues = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
}
return _routeValues;
}
set
{
_routeValues = value;
}
}
#endregion #endregion

Loading…
Cancel
Save