public static ModelMetadata BuildDropdownListenerAttributes(this ModelMetadata metadata, TemplateInfo templateInfo, ref IDictionary<string, object> attributes) { if (metadata.AdditionalValues.ContainsKey("dropdownlistener")) { var parentName = metadata.AdditionalValues["dropdownlistener-parent"].ToString(); var id = templateInfo.GetFullHtmlFieldId(parentName); attributes.Add("data-dropdownlistener", true); attributes.Add("data-dropdownlistener-parent", parentName); attributes.Add("data-dropdownlistener-callback", metadata.AdditionalValues["dropdownlistener-callback"]); } return metadata; }