public static void BindingByDataMap(this LayoutControl lc, DataMap map, params LayoutControlGroup[] lcgs) { if (lcgs == null || lcgs.Length == 0) { lcgs = lc.Items.OfType <LayoutControlGroup>().ToArray(); } foreach (LayoutControlGroup lcg in lcgs) { foreach (LayoutControlGroup group in lcg.Items.OfType <LayoutControlGroup>().Where(x => x.Items.Count > 0)) { lc.BindingByDataMap(map, group); } foreach (LayoutControlItem item in lcg.Items.OfType <LayoutControlItem>().Where(x => x.Control != null)) { var columnName = item.GetFieldNameByControlNoPattern(); if (!string.IsNullOrEmpty(columnName) && map.ContainsKey(columnName)) { item.SetControlValue(map.GetValue(columnName), null); } } } }