private static void GenerateControlsAllowClientID(EnableList enableList, IDictionary <string, string> list, EnableControls enableControls, string[] values) { foreach (IEnableControl control in enableList.Items) { control.EnableControls = enableControls; control.RefreshValues(); var innerList = control as EnableList; if (innerList != null) { GenerateControlsAllowClientID(innerList, list, enableControls, values); } else if (control.ControlID != null) { var controlId = control.ControlID; var clientId = control.GetClientID() ?? controlId;//позволит использовать на клиентские контролы без серверных if (values != null) { control.ControlID = controlId = string.Format(controlId, values); clientId = string.Format(clientId, values); } if (!list.ContainsKey(controlId)) { list.Add(controlId, clientId); } } } }
private static bool GenerateControls(EnableList enableList, IDictionary <string, string> list, EnableControls enableControls) { bool res; switch (enableList.ListMode) { case EnableListMode.And: res = true; break; case EnableListMode.Or: res = false; break; default: res = true; break; } foreach (IEnableControl control in enableList.Items) { control.EnableControls = enableControls; control.RefreshValues(); var innerList = control as EnableList; if (innerList != null) { bool value = GenerateControls(innerList, list, enableControls); switch (enableList.ListMode) { case EnableListMode.And: res &= value; break; case EnableListMode.Or: res |= value; break; } } else if (control.ControlID != null || control.TypeComponent == TypeComponent.Disable) { if (control.TypeComponent != TypeComponent.Disable && !list.ContainsKey(control.ControlID)) { list.Add(control.ControlID, control.GetClientID()); } bool equal = control.IsEquals(); bool disable = control.Disable; bool value = (equal && !disable) || (!equal && disable); switch (enableList.ListMode) { case EnableListMode.And: res &= value; break; case EnableListMode.Or: res |= value; break; } } else { res = false; } } return(res); }