var Dgv = Cls_NDBO.GetControlByType(this, typeof(GridView)); foreach (var control in Dgv) { // var grid = (GridView)control; GridView g = control as GridView; string intpu = grid.Name.Replace("Dgv_", string.Empty).ToString(); Insertion(grid, intpu); }
internal static IEnumerable<Control> GetControlByType(Control control, Type type) { var controls = control.Controls.Cast<Control>(); var enumerable = controls as Control[] ?? controls.ToArray(); return enumerable.SelectMany(ctrl => GetControlByType(ctrl, type)).Concat(enumerable).Where(predicate: c => c.GetType() == type).OrderBy(c => c.TabIndex); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)