public static NgSubMenu2 AttachSubMenu(NgTable t) { var sIndex = 0; var fIndex = 0; var tabIndex = 0; var tabStr = ""; fIndex = 0; NgSubMenu2 s = new NgSubMenu2(t.Name); var cCount = t.Columns.Count; if (cCount > 10) { s.IsTabbed = true; } s.CreateThisForm = true; s.NumberOfRowsInPaging = 20; s.AllowAddNewFeature = true; s.AllowEditFeature = true; s.AllowMultiDelete = true; s.AllowDelete = true; s.DeleteFormMessage = "Are you sure you want to delete this row?"; s.DeleteFormTitle = "Delete"; s.DisplayName = s.Name; s.Menues = "Menu"; s.NetClassName = s.Name; foreach (var c in t.Columns) { if (s.IsTabbed == true) { if (fIndex % 10 == 0) { tabIndex++; tabStr = "Tab " + tabIndex.ToString(); s.Tabs.Add(tabStr); } } NgField2 f = new NgField2(); if (s.IsTabbed == true) { f.TabName = tabStr; } if (!CommonFunctions.IsDuplicateFileds(s, c.Name)) { fIndex++; f.Index = fIndex; f.DisplayName = c.Name; f.OriginalName = c.Name; f.Type = c.DataType; f.Length = c.Length; f.IsIdentity = c.IsAuto; f.IsPrimaryKey = c.IsPrimary; f.NetType = CommonFunctions.GetNetDataType(f.Type); if (f.IsIdentity) { f.ToDisplayInControls = false; } if (f.NetType == "DateTime") { f.ControlType = ControlType.DatePicker; } else { f.ControlType = ControlType.TextBox; } if (c.IsNullable == false) { f.IsValidationRequired = true; f.ErrorMessage = "Please enter the " + f.DisplayName; } if (c.IsAuto == true) { f.ToDisplayInControls = false; } else { f.ToDisplayInControls = true; } if (fIndex > 8) { f.ToDisplayInGrid = false; } else { f.ToDisplayInGrid = true; } s.Model.Fields.Add(f); } } sIndex++; s.Index = sIndex; return(s); }