public static void limpiarPanel(ref System.Web.UI.WebControls.Panel myPanel) { if (myPanel == null) { throw new ArgumentNullException("El argumento myPanel no puede estar Nulo"); } if (myPanel.HasControls()) { foreach (Control c in myPanel.Controls) { switch (c.GetType().FullName) { case "Telerik.Web.UI.RadTextBox": ((RadTextBox)c).Text = string.Empty; break; case "Telerik.Web.UI.RadNumericTextBox": ((RadNumericTextBox)c).Text = string.Empty; break; case "System.Web.UI.WebControls.CheckBox": ((CheckBox)c).Checked = false; break; case "Telerik.Web.UI.RadDropDownList": ((RadDropDownList)c).Items.Clear(); break; case "Telerik.Web.UI.RadComboBox": ((RadComboBox)c).Items.Clear(); break; //case "System.Web.UI.WebControls.Label": // ((Label)c).Text = string.Empty; // break; case "System.Web.UI.WebControls.TextBox": ((TextBox)c).Text = string.Empty; break; } } } }
private void ExtractDeviceFilterSchemas(System.Web.UI.Control control) { if (null == control) { return; } MobileControl mobileControl = control as MobileControl; if (null != mobileControl) { DeviceSpecific deviceSpecific; DeviceSpecificChoiceCollection choices; if (mobileControl is StyleSheet) { StyleSheet styleSheet = (StyleSheet) mobileControl; ICollection styleKeys = styleSheet.Styles; foreach (String key in styleKeys) { Style style = styleSheet[key]; deviceSpecific = style.DeviceSpecific; if (null != deviceSpecific && _ds != deviceSpecific) { choices = deviceSpecific.Choices; foreach (DeviceSpecificChoice choice in choices) { if (choice.Xmlns != null && choice.Xmlns.Length > 0 && !_strCollSchemas.Contains(choice.Xmlns)) { _strCollSchemas.Add(choice.Xmlns); } } } } } else { deviceSpecific = mobileControl.DeviceSpecific; if (null != deviceSpecific && _ds != deviceSpecific) { choices = deviceSpecific.Choices; foreach (DeviceSpecificChoice choice in choices) { if (choice.Xmlns != null && choice.Xmlns.Length > 0 && !_strCollSchemas.Contains(choice.Xmlns)) { _strCollSchemas.Add(choice.Xmlns); } } } } } if (control.HasControls()) { foreach (System.Web.UI.Control child in control.Controls) { ExtractDeviceFilterSchemas(child); } } }
private System.Web.UI.Control GetAllCtrls(string strid, System.Web.UI.Control ct) { if (ct.ID == strid) { return ct; } else { if (ct.HasControls()) { foreach (System.Web.UI.Control ctchild in ct.Controls) { System.Web.UI.Control ctrtn = GetAllCtrls(strid, ctchild); if (ctrtn != null) { return ctrtn; } } return null; } else { return null; } } }
public static int GetVisibleChildrenCount(System.Web.UI.Control container) { if(container == null || (!container.HasControls())) return 0; int count = 0; foreach(System.Web.UI.Control control in container.Controls) { if(control.Visible) count++; } return count; }