@{ var scope = ViewBag.ControllerScope as string; var props = ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForEdit && !pm.HideSurroundingHtml && !pm.IsComplexType && !pm.IsCollectionType && pm.PropertyName != "Id").ToList(); foreach (var prop in props) { if(scope=="Organ"&&prop.PropertyName=="OrganId") { continue; } var templateName = prop.DataTypeName ?? prop.TemplateHint ?? (prop.ModelType == typeof(string) ? typeof(string).Name : null);